I have the names of a group of data frames given in the variable "dfs", as an array of Strings. I.e.
> dfs
"dfs1" "dfs2" ... "dfsk"
I want to rename the columns of each of the data frame in dfs. That means I want to apply a function 'func' to each of the entries in dfs and write the result back. I.e. the result should be equal to evaluating
dfs1 <- func(dfs1)
dfs2 <- func(dfs2)
...
dfsk <- func(dfsk)
The difficulty is, that dfs might be arbitrarily long and the content of dfs is only known at runtime.
I have tried to write a function func and apply it to dfs using:
lapply( mget(dfs), func)
However this leaves the actual data.frames unchanged.
My Question has similarities to the following unanswered Question: