suppose I have a list of dataframes as follows:
df1 <- data.frame(a1 = 1:5, a2 = 1:5, a3 = 1:5)
df2 <- data.frame(a1 = 1:3, a2 = 2:4, a3 = 3:5)
df3 <- data.frame(a1 = 10:20, a2 = 5:15)
l <- list(df1 = df1, df2 = df2, df3 = df3)
What should I do to perform operations (like mutate) on each element on the list conditioning on the elements name?
For instance - how would I proceed If I wanted to add some new column only if was dealing with df1 or df3 and wanted to delete some column if I was dealing with df2?
Could map_if deal with that?
PS: Keep in mind that the list would probably have more than 3 datasets so that possibly multiple conditions would be needed.