Re: [R] Function to return variable name

2010-07-29 Thread Allan Engelhardt
On 29/07/10 04:21, Jeremy Miles wrote: I'd like a function that returns the variable name. As in: MyData$Var1 Would return: Var1 Not quite sure what you mean, but does this get you started? nn <- function(x) deparse(substitute(x)) str( z <- nn(airquality$Month) ) # chr "airquality$Mon

[R] Function to return variable name

2010-07-28 Thread Jeremy Miles
I'd like a function that returns the variable name. As in: MyData$Var1 Would return: Var1 There should be a straightforward way to do this, but I can't see it. Thanks, Jeremy -- Jeremy Miles Psychology Research Methods Wiki: www.researchmethodsinpsychology.com __