[R] frequency
Uwe Ligges
ligges at statistik.uni-dortmund.de
Fri Mar 8 12:03:30 CET 2002
gfaieta at katamail.com wrote:
>
> I'm quite new with R so sorry if I asked something very easy or complicated.
> I have a data frame with (for instance) 4 variables (4 columns) and 100 records. I would like to have a 'summary' table for each variable that shows me the following:
>
> variable 1 Freq. % % cumulative
>
> class 1 10 10% 10%
> class 2 20 20% 30%
> class 3 70 70% 100%
Assume you data.frame is called DAT. With
lapply(DAT, table)
you can apply the function table() on each variable of the data.frame.
Uwe Ligges
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list