Skip to content
Back to formatted view

Raw Message

Message-ID: <3C889A82.7E12F866@statistik.uni-dortmund.de>
Date: 2002-03-08T11:03:30Z
From: Uwe Ligges
Subject: frequency

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