Skip to content

Commit

Permalink
reviewed nbalance computation
Browse files Browse the repository at this point in the history
  • Loading branch information
SOloo15 committed Jan 18, 2024
1 parent 3976d27 commit a726e11
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion R/nitrogen_balance.R
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ n_balance <- function(para, land_required, soil_erosion){
nue = ifelse(is.na(nout/nin), 0, nout/nin),
nbalance_kg_n_total = nin-nout,
nbalance_kg_n_ha_total = ifelse(is.na(nbalance_kg_n_total/area_total), 0, nbalance_kg_n_total/area_total),
nbalance_feed_only_kg_n = ifelse(nbalance_kg_n_total==0, 0, ifelse(out2==0, nbalance_kg_n_total*out2/(out2+out1), 0)),
nbalance_feed_only_kg_n = ifelse(nbalance_kg_n_total==0, 0, ifelse(out2==0, nbalance_kg_n_total, nbalance_kg_n_total*out2/(out2+out1))),
nbalance_feed_only_kg_n_ha = ifelse(is.na(nbalance_feed_only_kg_n/area_total), 0, nbalance_feed_only_kg_n/area_total)) %>%
dplyr::mutate_if(is.numeric, list(~na_if(.,Inf))) %>%
replace(is.na(.), 0)%>%
Expand Down

0 comments on commit a726e11

Please sign in to comment.