I am still struggling to map a character string to an object name and
vice versa in R.
I thought the as.name() function might work, but observe the following
behaviour ...

> attach(warpbreaks)
> levels(tension)
[1] "L" "M" "H" 
> levels(as.name("tension"))
NULL
> objectname<-as.name("tension")
> objectname
tension
> levels(objectname)
NULL

So even though it sets up a symbol, this symbol isn't recognised as an
object name by functions such as levels().

I need 2 functions, call them A and B such that A("tension") yields the
object name tension which is recognised by functions and
B(tension) yields the character result "tension".

Any suggestions would be greatly appreciated,

Philip



 





This message should be regarded as confidential. If you have received this 
email in error please notify the sender and destroy it immediately.
Statements of intent shall only become binding when confirmed in hard copy by 
an authorised signatory.  The contents of this email may relate to dealings 
with other companies within the Detica Group plc group of companies.

Detica Limited is registered in England under No: 1337451.

Registered offices: Surrey Research Park, Guildford, Surrey, GU2 7YP, England.



        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org 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