Dear collegues,
How can I get the name of a variable (and not the variable) within a function ?
For instance, in the following function, I'd like to create a variable in the dataframe df with the same name to the variable passed in var:



prova <- function( var ) { df <- as.data.frame(matrix(nr=20,nc=0)) df[["here"]] <- seq(min(var), max(var), le= 20) # df }

for instance,

a <- 1:50
prova(a)

should give a dataframe with a variable called a (df$a)
Thanks in advance

Juli

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help

Reply via email to