Re: [R] List of lists???

From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Date: Wed 01 Feb 2006 - 01:50:07 EST

Your post seems to be messed up but I will assume you have a 5 column data frame and the questino is how to run f on the first three columns and separately on the last two. I think the easiest is just the following where I have used the builtin iris data set where I have assumed that the operation you want to perform is summary for purposes of example:

summary(iris[,1:3])
summary(iris[,4:5])

If this is not your real problem and the real problem has many more divisions then try this where div is a factor that defines the division of columns into sets:

div <- factor(c(1,1,1,2,2))
lapply(split(names(iris), div), function(n) summary(iris[n]))

On 1/31/06, Stephane CRUVEILLER <scruveil@genoscope.cns.fr> wrote:
> Hi,
>
> I would like to perform computations on some variables belonging to the same
> dataframe. For instance my data frame has the following shape:
> toto1toto2toto3toto4toto5
> 1 12345
> 2678910
>
> I would like to perform the calculation on c("toto1","toto2","toto3") and then
> the same calculation on c("toto4","toto5"). Is there a way to tell R to do it
> using 3 loop (a list of lists)??
>
> Stephane.
> --
> ==========================================================
> Stephane CRUVEILLER Ph. D.
> Genoscope - Centre National de Sequencage
> Atelier de Genomique Comparative
> 2, Rue Gaston Cremieux CP 5706
> 91057 Evry Cedex - France
> Phone: +33 (0)1 60 87 84 58
> Fax: +33 (0)1 60 87 25 14
> EMails: scruveil@genoscope.cns.fr ,scruvell@infobiogen.fr
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed Feb 01 02:00:34 2006

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:42:15 EST