R-help, I have a list of several data frames. I want to compute the "rowSums" of the columns of these data frames but first one. Something like this lapply(my.list,rowSums) Thank you Luis Ridao Cruz Fiskiranns??knarstovan N??at??n 1 P.O. Box 3051 FR-110 T??rshavn Faroe Islands Phone: +298 353900 Phone(direct): +298 353912 Mobile: +298 580800 Fax: +298 353901 E-mail: luisr at frs.fo Web: www.frs.fo
> From: Luis Rideau Cruz > > R-help, > > I have a list of several data frames. > > I want to compute the "rowSums" of the columns of these data > frames but first one. > > Something like this > > lapply(my.list,rowSums)You're almost there: lapply(my.list, function(x) rowSums(x[-1])) Andy> Thank you > > > Luis Ridao Cruz > Fiskiranns??knarstovan > N??at??n 1 > P.O. Box 3051 > FR-110 T??rshavn > Faroe Islands > Phone: +298 353900 > Phone(direct): +298 353912 > Mobile: +298 580800 > Fax: +298 353901 > E-mail: luisr at frs.fo > Web: www.frs.fo > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html > >
Luis Rideau Cruz wrote:> R-help, > > I have a list of several data frames. > > I want to compute the "rowSums" of the columns of these data frames but first one.... "but first data.frame" or "but first column"? "but first data.frame": lapply(my.list[-1], rowSums) "but first column": lapply(my.list, function(x) rowSums(x[,-1])) Uwe Ligges> > Something like this > > lapply(my.list,rowSums) > > Thank you > > > Luis Ridao Cruz > Fiskiranns??knarstovan > N??at??n 1 > P.O. Box 3051 > FR-110 T??rshavn > Faroe Islands > Phone: +298 353900 > Phone(direct): +298 353912 > Mobile: +298 580800 > Fax: +298 353901 > E-mail: luisr at frs.fo > Web: www.frs.fo > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html