Something like this?

R> f <- function(x) deparse(substitute(x))
R> a <- 1:3
R> f(a)
[1] "a"

Andy

From: new ruser
> 
> #Sorry for the convoluted subject line.
> 
> #I have:
> 
> a=c(1,2,3)
> x=a #example of user supplied input
> 
> 
> #Is there any function that will tell me the "name" of the 
> object x refers to, referring only to x itself? 
> #i.e. the "answer" I want is "a"
> 
> #I want: 
> #fun(x) == 'a'
> 
> #(I don't think this is possible, but figured I'd ask.)
> 
> 
> 
>        
> ---------------------------------
> Got a little couch potato? 
> Check out fun summer activities for kids.
>       [[alternative HTML version deleted]]
> 
> ______________________________________________
> [email protected] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 
> 
> 


------------------------------------------------------------------------------
Notice:  This e-mail message, together with any attachments,...{{dropped}}

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to