diff --git a/R/derive_params_growth_age.R b/R/derive_params_growth_age.R index 5a61ea1..02656b5 100644 --- a/R/derive_params_growth_age.R +++ b/R/derive_params_growth_age.R @@ -231,7 +231,7 @@ derive_params_growth_age <- function(dataset, bins <- get_bins(meta_criteria, param = "AGE") # create a unified join naming convention, hard to figure out in by argument - dataset2 <- dataset %>% + relevant_records <- dataset %>% filter(!!enexpr(parameter)) %>% mutate( sex_join := {{ sex }}, @@ -260,7 +260,7 @@ derive_params_growth_age <- function(dataset, ) # Merge the dataset that contains the vs records and filter the L/M/S that fit the appropriate age - added_records <- dataset2 %>% + added_records <- relevant_records %>% left_join(., processed_md, by = c("sex_join", "ageu_join", "age_bins") diff --git a/R/derive_params_growth_height.R b/R/derive_params_growth_height.R index 5b1414c..720dad3 100644 --- a/R/derive_params_growth_height.R +++ b/R/derive_params_growth_height.R @@ -218,7 +218,7 @@ derive_params_growth_height <- function(dataset, bins <- get_bins(meta_criteria, param = "HEIGHT_LENGTH") # create a unified join naming convention, hard to figure out in by argument - dataset2 <- dataset %>% + relevant_records <- dataset %>% filter(!!enexpr(parameter)) %>% mutate( sex_join := {{ sex }}, @@ -247,7 +247,7 @@ derive_params_growth_height <- function(dataset, ) # Merge the dataset that contains the vs records and filter the L/M/S that match height - added_records <- dataset2 %>% + added_records <- relevant_records %>% left_join(., processed_md, by = c("sex_join", "heightu_join", "ht_bins")