I have a list of dataframes. I want to mutate 2 and 3 column of all the dataframes such that each column= column*3. But I want the names of the column to be same (dynamically created). Here the column names are different in each dataframe. So for example i want 2nd column of all dataframes to get mutiplied by 3 while retaining the same name. simillarly for 3rd column.
so for first dataframe it should be z=z2, J= j2 for 2nd dataframe k= k2,x=x2 etc.
I want to pass column indices as names might not be fixed.
df_function <- function(n) {
df <- data.frame(A = sample(n), runif(n), runif(n), rbinom(n, 2, .2))
names(df)[-1] <- sample(LETTERS[-1], 3)
return(df)
}
set.seed(123)
df_list1 <- 1:5 %>% map(., ~ df_function(5))