I have multiple data frames. In each one of them, I need to convert the 1st row into column names
My code is as follows:
Assign all dataframes into cities
cities <- objects()
library(janitor)
for (i in cities){
paste0("file_",i) <- assign(i, get(i) %>% row_to_names(row_number = 1))
}
This code creates the following error:
Error in paste0("file_", i) <- assign(i, get(i) %>% row_to_names(row_number = 1)) : target of assignment expands to non-language object
How can I fix this problem?