I have a data.frame
, and a vector of variables names
a <- data.frame(x1=rnorm(20),x2=rnorm(20),x3=rnorm(20),x4=rnorm(20),x5=rnorm(20),x6=rnorm(20),x7=rnorm(20),x8=rnorm(20),x9=rnorm(20),x10=rnorm(20))
How can I apply a function to
so that it affects only variables names in
in a way that doesn't subset
? Meaning that the variables from
are replaced with the output of the function leaving rest of the variables unaltered.
I can always just run a function, for example
and just merge the output with
, but there must be a more direct way?