Skip to content

Commit

Permalink
knfi 1.0.1.0009
Browse files Browse the repository at this point in the history
  • Loading branch information
SYOUNG9836 committed Nov 30, 2024
1 parent 87c27ff commit fd6e2b5
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions R/biomass_nfi.R
Original file line number Diff line number Diff line change
Expand Up @@ -384,18 +384,18 @@ biomass_nfi <- function(data, byplot= FALSE, plotgrp=NULL, treegrp= NULL, contin

# 2.1.1 Double sampling for post-strat(by forest stand)
weight_plotgrp <- data$plot %>%
group_by(!!!plotgrp) %>%
summarise(plot_num_all = n(),.groups = 'drop')
group_by(CYCLE, !!!plotgrp) %>%
summarise(plot_num_all = n_distinct(!!plot_id),.groups = 'drop')


weight_year <- data$plot %>%
group_by(CYCLE, INVYR, !!!plotgrp) %>%
summarise(plot_num_year = n(),.groups = 'drop')
summarise(plot_num_year = n_distinct(!!plot_id),.groups = 'drop')


weight_stand <- data$plot %>%
group_by(CYCLE, INVYR, !!strat, !!!plotgrp) %>%
summarise(plot_num_stand = n(),.groups = 'drop')
summarise(plot_num_stand = n_distinct(!!plot_id),.groups = 'drop')


weight_DSS <- full_join(weight_stand, weight_year, by =c("CYCLE", "INVYR", as.character(unlist(lapply(plotgrp, quo_name)))))
Expand Down Expand Up @@ -477,7 +477,7 @@ biomass_nfi <- function(data, byplot= FALSE, plotgrp=NULL, treegrp= NULL, contin


# 2.1.4 Weighted Moving Average(to combine annual inventory field data)
weight_WMA <- full_join(weight_year, weight_plotgrp, by =c(as.character(unlist(lapply(plotgrp, quo_name)))))
weight_WMA <- full_join(weight_year, weight_plotgrp, by =c("CYCLE", as.character(unlist(lapply(plotgrp, quo_name)))))
weight_WMA$weight_WMA <- weight_WMA$plot_num_year/weight_WMA$plot_num_all


Expand Down Expand Up @@ -783,17 +783,17 @@ biomass_tsvis <- function(data, plotgrp=NULL, treegrp=NULL, strat="FORTYP_SUB",
# 2.1.1 Double sampling for post-strat(forest stand)
weight_plotgrp <- data$plot %>% # not CYCLE
group_by(!!!plotgrp) %>%
summarise(plot_num_all = n(),.groups = 'drop')
summarise(plot_num_all = n_distinct(!!plot_id),.groups = 'drop')


weight_year <- data$plot %>%
group_by(CYCLE, INVYR, !!!plotgrp) %>%
summarise(plot_num_year = n(),.groups = 'drop')
summarise(plot_num_year = n_distinct(!!plot_id),.groups = 'drop')


weight_stand <- data$plot %>%
group_by(CYCLE, INVYR, !!strat, !!!plotgrp) %>%
summarise(plot_num_stand = n(),.groups = 'drop')
summarise(plot_num_stand = n_distinct(!!plot_id),.groups = 'drop')


weight_DSS <- full_join(weight_stand, weight_year, by =c("CYCLE", "INVYR", as.character(unlist(lapply(plotgrp, quo_name)))))
Expand Down

0 comments on commit fd6e2b5

Please sign in to comment.