Use input of a function as variable name in R