[R] extracting object names as strings
Agustin Lobo
alobo at ija.csic.es
Tue Oct 30 10:25:21 CET 2001
Look at the example in help(deparse).
deparse(substitute(x)) is used there, as.character(substitute(x))
should also work.
Actually, I made a simple function named "get.name"
with the first solution just to have an easier-to-remember
function!
Agus
Dr. Agustin Lobo
Instituto de Ciencias de la Tierra (CSIC)
Lluis Sole Sabaris s/n
08028 Barcelona SPAIN
tel 34 93409 5410
fax 34 93411 0012
alobo at ija.csic.es
On Mon, 29 Oct 2001, David A Richmond wrote:
> Hi,
> I'm looking for a function which returns the name of the argument
> object as a string:
>
> >vect <- 1:3
> >function(vect)
> "vect"
>
> I've looked at 'name', 'names', 'objects', none seem to do exactly what I
> want. ls/objects comes close, but I can't figure out how to force it to
> give me only one object name.
>
> daver
>
> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
> |David Richmond It works on a |
> + Dept. of Sociology complex scientific +
> |Saint Mary's College principle, known as |
> + Notre Dame, IN 46556 "pot luck." +
> |219-284-4517 - The Doctor |
> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
>
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list