It would be easier with a reprex but what if you define the named character to pass to by
outside left_join
?
by_var <- setNames(opts$r, opts$I)
joined_df <- left_join(input_df, countries, by = by_var)
I am not sure you can use var1 = var2
as a named vector. The name must be a character.
With tidyeval, you the :=
operator for that, but the verbs must support this syntax and I am not sure *_join
does like in mutate verbs for instance.