[R] How to avoid "$ operator is invalid for atomic vectors"

John Kane jrkrideau at yahoo.ca
Thu Nov 6 19:40:32 CET 2008


Does this help
(mylist <- list(NULL))


(mylist[[3]] <- data.frame(a=1:4, b=letters[1:4]))
mylist

(mylist[[2]] <- matrix(1:12, nrow=4))

mylist


--- On Thu, 11/6/08, cruz <cruadam at gmail.com> wrote:

> From: cruz <cruadam at gmail.com>
> Subject: Re: [R] How to avoid "$ operator is invalid for atomic vectors"
> To: r-help at r-project.org
> Received: Thursday, November 6, 2008, 1:16 PM
> Thanks for all the responses, they are all very helpful:)
> 
> > you don't need to assign dimension or classes to
> your objects.
> > It's easier if you  do like this
> 
> this is something that really bothers me, when I need to
> define an
> object which i will later fill with data, the dimension of
> this object
> should not be fixed because it will grow...
> 
> so in MATLAB, i.e. we define x = [ ],
> what about in R?
> 
> Thanks,
> cruz
> 
> ______________________________________________
> R-help at 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.


      __________________________________________________________________
[[elided Yahoo spam]]



More information about the R-help mailing list