[R] data.frame - how to calculate the number of rows

From: Pfeiffer & Koberstein Immobilien GmbH - Ralf Pfeiffer <ralf.pfeiffer_at_pfeiffer-koberstein-immobilien.de>
Date: Wed, 26 Dec 2007 20:08:12 +0100


Hello,

it seems to be a simple problem, but I couldn't find an answer in the archiv. (I think, it must has something to do with the group-select, like in php)

I've the following data.frame:

        A            B                C
1      3             6                 5
2      4             4                 20
3      5             8                 2

I want to get the number of the rows in the 4th column, like:

        A            B                C                      num rows
1      3            6                 6.16                  3


(B is mean, C is variance by using summaryBy(B+C~ A, data=daten, FUN=c(mean,var)) from the doBy-package)

But, how can I add the column 'numrow' and count the number of the rows?

Thanks!

Macki



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 Wed 26 Dec 2007 - 19:18:12 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 Wed 26 Dec 2007 - 20:30:20 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.