Skip to content

Commit

Permalink
feat: #1966 hacky solution to null new_vars .join problem
Browse files Browse the repository at this point in the history
  • Loading branch information
Zelos Zhu committed Jul 19, 2023
1 parent 2fece95 commit 651168f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions R/derive_joined.R
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,8 @@ derive_vars_joined <- function(dataset,

filter_add <- assert_filter_cond(enexpr(filter_add), optional = TRUE)
filter_join <- assert_filter_cond(enexpr(filter_join), optional = TRUE)

if (is.null(new_vars)) {
original_new_vars <- new_vars
new_vars <- chr2vars(colnames(dataset_add))
}

Expand Down Expand Up @@ -404,7 +404,7 @@ derive_vars_joined <- function(dataset,
}

# merge new variables to the input dataset and rename them
data %>%
data_final <- data %>%
derive_vars_merged(
dataset_add = data_return,
by_vars = exprs(!!!by_vars_left, !!tmp_obs_nr),
Expand All @@ -424,4 +424,10 @@ derive_vars_joined <- function(dataset,
)
) %>%
remove_tmp_vars()

if(is.null(original_new_vars)){
data_final <- data_final %>%
select(-ends_with("join"))
}
return(data_final)
}

0 comments on commit 651168f

Please sign in to comment.