[R] cant find "get"?

Strumila, John John.Strumila at team.telstra.com
Fri Sep 1 01:55:25 CEST 2000


thanks heaps Thomas,

I played with substitute, eval and deparse but it would have taken me a
month of sundays to figure this one out.  I'm still trying to understand
your explanation!

I reckon this R-list and it's contributors are great.

thanks,
John Strumila

-----Original Message-----
From: Thomas Lumley [mailto:thomas at biostat.washington.edu]
Sent: Friday, 1 September 2000 9:32
To: Strumila, John
Cc: r-help at stat.math.ethz.ch
Subject: Re: [R] cant find "get"?

On Fri, 1 Sep 2000, Strumila, John wrote:

> howdy gurus,
> 
> I was wondering if someone could help me with what looks like a simple
> problem.
> 
> I found this great function called "get" which allows me to work out my
> object name at run time.  Unfortunately it's not letting me assign values
> with it.  What am I doing wrong?
> 
> thanks,
> John Strumila
> 
> >   names(get(file.name))[1]
> [1] "X14.59.23"
> >   names(get(file.name))[1] <- "date"
> Error: couldn't find function "get<-"

...

What you want to do is
   eval(substitute(names(x)[1]<-"date",list(x=as.name(file.name))))
except that you would probably be better off just finding out what your
variable was called and using its name.  This sort of double indirection
is just too complicated.

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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