[R] retrieve name of an object?

Liviu Andronic landronimirc at gmail.com
Wed Aug 4 13:47:38 CEST 2010


Dear all
Is there an easier way to retrieve the name of an object? For example, 
> tmp <- 1:10
> as.character(quote(tmp))
[1] "tmp"
> as.character(quote(mtcars$cyl))
[1] "$"      "mtcars" "cyl"   
> as.character(quote(mtcars$cyl))[3]
[1] "cyl"

The last call more than anything seems a hack. Is there a better way? 

Thank you
Liviu



More information about the R-help mailing list