powered by
apply a function to each of a list of variables
forvar(varlist, action, macro = "%var")
a list of variables in the format ~var1+var2+var3+... or as a vector of names like "var1 var2 var3".
a quoted expression to apply to each variable where the variable is represented in the expression by macro.
macro
an expression that will be replaced in action for each variable, by default %var.
action
returns NULL, invisibly
# NOT RUN { use(cars, clear=TRUE) forvar("speed dist", "gen('%var2', '%var^2')") listif() # }
Run the code above in your browser using DataLab