Skip to content

Commit

Permalink
should fix it
Browse files Browse the repository at this point in the history
  • Loading branch information
zdz2101 committed Jul 31, 2024
1 parent 314c097 commit 7cac8fc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
5 changes: 3 additions & 2 deletions R/derive_params_growth_age.R
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ derive_params_growth_age <- function(dataset,

# create a unified join naming convention, hard to figure out in by argument
dataset2 <- dataset %>%
filter(!!enexpr(parameter)) %>%
mutate(
sex_join := {{ sex }},
ageu_join := {{ age_unit }},
Expand Down Expand Up @@ -272,7 +273,6 @@ 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 %>%
filter(!!enexpr(parameter)) %>%
left_join(.,
processed_md,
by = c("sex_join", "ageu_join", "age_bins")
Expand All @@ -281,7 +281,8 @@ derive_params_growth_age <- function(dataset,

by_exprs <- enexpr(by_vars)
by_antijoin <- setNames(as.character(by_exprs), as.character(by_exprs))
unmatched_records <- anti_join(dataset, added_records, by = by_antijoin)
unmatched_records <- anti_join(dataset, added_records, by = by_antijoin) %>%
filter(!!enexpr(parameter))

dataset_final <- dataset

Expand Down
9 changes: 5 additions & 4 deletions R/derive_params_growth_height.R
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,8 @@ 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
dataset <- dataset %>%
dataset2 <- dataset %>%
filter(!!enexpr(parameter)) %>%
mutate(
sex_join := {{ sex }},
heightu_join := {{ height_unit }},
Expand Down Expand Up @@ -258,8 +259,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 <- dataset %>%
filter(!!enexpr(parameter)) %>%
added_records <- dataset2 %>%
left_join(.,
processed_md,
by = c("sex_join", "heightu_join", "ht_bins")
Expand All @@ -268,7 +268,8 @@ derive_params_growth_height <- function(dataset,

by_exprs <- enexpr(by_vars)
by_antijoin <- setNames(as.character(by_exprs), as.character(by_exprs))
unmatched_records <- anti_join(dataset, added_records, by = by_antijoin)
unmatched_records <- anti_join(dataset, added_records, by = by_antijoin) %>%
filter(!!enexpr(parameter))

dataset_final <- dataset

Expand Down

0 comments on commit 7cac8fc

Please sign in to comment.