[R] Associative array and How to store a set of objects ?
Gabor Csardi
csardi at rmki.kfki.hu
Mon Apr 14 14:39:17 CEST 2008
On Mon, Apr 14, 2008 at 08:32:55PM +0800, Ng Stanley wrote:
> Hi,
>
> Two questions:
>
> A) Assuming OB is an object, how do I store 20 of OB in a vector or list ?
replicate(20, OB, simplify=FALSE)
> B) Does R has something similar associative array to Perl ? For example,
> %our_friends = ('best', 'Don', 'good', 'Robert', 'worst', 'Joe');
> $our_friends{'cool'} = "Karen";
our.friends <- list(best="Don", good="Robert", worst="Joe")
our.friends[["cool"]] <- "Karen"
G.
PS. Concerning the second question, what about reading 'Introduction to R'?
> Thanks
> Stanley
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
--
Csardi Gabor <csardi at rmki.kfki.hu> UNIL DGM
More information about the R-help
mailing list