[R] puzzles with assign()
David.Epstein
David.Epstein at warwick.ac.uk
Wed May 5 14:56:07 CEST 2010
Duncan Murdoch-2 wrote:
>
> ...<snip>...
> That's because constructing names like this is generally a bad idea.
> But you can do it; you use get() to get the object whose name is in
> temp.name. So put data=get(temp.name) into your lm() call.
>
I had another useful answer (sent privately) from Patrick Burns. His "R
inferno" seems like a helpful source of information. Here's a quote from
page 12 that has been very helpful in simplifying my code and making it more
comprehensible. The key seems to be to index a list by character strings.
Patrick Burns wrote:
>
> A fairly common question from new users is: “How do I assign names to a
> group of similar objects?” Yes, you can do that, but you probably don’t
> want
> to—better is to vectorize your thinking. Put all of the similar objects
> into one
> list. Subsequent analysis and manipulation is then going to be much
> smoother.
>
Thanks to both.
David
--
View this message in context: http://r.789695.n4.nabble.com/puzzles-with-assign-tp2130691p2130887.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list