In R, I often times need to do the same operation for a group of variables.
As an example, on my environment I currently have the following of data frames:
df_model1
df_model2
df_model3
df_model4
df_model5
and I have another data frame called df_obs
.
What I need to do is to merge each of the df-model*
data frame to df_obs
.
What I usually do is something like this:
new_df_model1 <- merge(df_obs, df_model1, all=TRUE)
new_df_model2 <- merge(df_obs, df_model2, all=TRUE)
...
and so on, which is clearly not very practical.
How can I make this operation more programmatic?