Re: [R] Associative array and How to store a set of objects ?

From: Gabor Csardi <csardi_at_rmki.kfki.hu>
Date: Mon, 14 Apr 2008 14:39:17 +0200

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

______________________________________________
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.
Received on Mon 14 Apr 2008 - 14:54:49 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 14 Apr 2008 - 15:00:28 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive