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

From: Ng Stanley <stanleyngkl_at_gmail.com>
Date: Mon, 14 Apr 2008 20:52:36 +0800

Hi,

Didn't make myself clear on A). The twenty OBs are all different, how to store them in a vector or list ?

Your solution to B) is nice and clear. Will read up on the Introduction also.

On Mon, Apr 14, 2008 at 8:39 PM, Gabor Csardi <csardi_at_rmki.kfki.hu> wrote:

> 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<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
>

        [[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. Received on Mon 14 Apr 2008 - 12:55:39 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:30: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