Open LienReyserhove opened 5 years ago
Also keep in mind that now, the build_source_citation()
function is based upon a fixed name datasetKey
in the checklist.csv
file --> bottleneck!
Also keep in mind that now, the build_source_citation() function is based upon a fixed name datasetKey in the checklist.csv file --> bottleneck!
After the "brain storming" of yesterday about merging (see https://github.com/tidyverse/dplyr/issues/4120#issuecomment-456574471 and StackOverflow answer) here below a compact solution:
# Data input
df_1 <- tibble::tibble(col1_df1 = c("aaa","bbb"),
col2_df1 = c(1,2))
df_2 <- tibble::tibble(col1_df2 = c("aaa", "bbb", "ccc"),
col2_df2 = c(1,2, 4))
# Function declaration
dummy_function <- function(df1, df2, col_df1_join, col_df2_join) {
df1 <-
df1 %>%
left_join(df2,
by = c(col_df1_join, col_df2_join)
)
return(extension_name)
}
# Column names to use for joining
a <- "col1_df1"
b <- "col1_df2"
# Apply function
dummy_function(df_1, df_2, a , b)
Thank you for the input! I'm now working on the function, but I'm using setNames()
, as suggested yesterday. Good idea?
I will integrate this in a separate PR soon, so you can evaluate the code on its content and perhaps clean the style a bit, as I'm not that familiar with writing functions :-)
Should be considered for change, now it's confusing. To do after first publication: