I am trying to convert the variable names of multiple datasets to all lower case.
names(data1) <- tolower(names(data1))
That works for any single dataset, but I have not figured out how to loop over datasets to do it to multiple files. Here is a for loop I attempted (I also tried with lapply
but did not have any luck).
data_list <- c('data1', 'data2', 'data3')
for (file in data_list) {
names(file) <- tolower(names(file))
}
I also tried:
data_list <- list('data1', 'data2', 'data3')
for (file in data_list) {
names(file) <- tolower(names(file))
}