[R] Am I misunderstanding loop variable assignment or how to use print()?

Tony Stocker akostocker at gmail.com
Thu Dec 15 16:43:43 CET 2011


On Thu, Dec 15, 2011 at 09:51, Sarah Goslee <sarah.goslee at gmail.com> wrote:
> But "anova.ag.m2529.az"  is a character string that happens to be the
> *name* of an anova object, but R has no way to know that unless you
> specifically tell it that your character string is an object by using
> get().
>
> Something like print(get(x)) would work.

Sarah - Thanks very much!  That did indeed work great at printing the
entire contents out.  I couldn't do print(get(x$Pr)), but I can live
with that for now.

>
> It's often neater and more efficient to store your anova objects in a
> list, though.

So if I were to do:
> is.list(an)
[1] FALSE
> alist<-list(an)
> is.list(alist)
[1] TRUE
> alist
[1] "anova.ag.m2529.az"   "anova.ag.m2529.can"   "anova.ag.m2529.fl"

I would have created a list, but I'm assuming that you mean something
different than that since I'm not sure how that functionally changed
anything since it's still a set of character strings.  Could you
elaborate a bit on what you mean by storing the anova objects as
lists?

Again, thanks for the help!



More information about the R-help mailing list