[R] frequency table

lamack lamack lamac_k at hotmail.com
Thu Sep 21 17:15:02 CEST 2006


Dear all, I have a vector like this:

z = rep(c("M","F"),c(50,60))

How can I get the following frequency table:

Sex             counts     %
F                60           54.5
M               50           45.5

I try:

DD<-   function(data,...)
{
    n       <-  nobs(data)
    out     <-  c(Frequency  = n,
                  k = n/length(data))
    return(out)
}


mApply(z,z,DD)   but ....


Best regards

_________________________________________________________________
Insta-le agora o Windows Live Messenger



More information about the R-help mailing list