[R] the name of a variable in a function

2003-09-17 Thread juli g. pausas
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 -

Re: [R] the name of a variable in a function

2003-09-17 Thread Douglas Bates
Well you don't know that the actual argument to a function is a name - it could be a more complex expression. In any case, you can get the expression that was the actual argument with the substitute function, then you need to deparse it. Your function could be written prova - function( var ) +