[R] Frequency table

Peter Dalgaard p.dalgaard at biostat.ku.dk
Wed Mar 17 16:41:01 CET 2004


Kai Hendry <hendry at cs.helsinki.fi> writes:


> 40-49   2
> 50-59   15
> 60-69   20
> 70-79   19
> 80-89   12
> 90-99   2

Here's another solution for this 10-year age group thing:

tt<-table(zz%/%10)
n <- names(tt)
names(tt) <- paste(n,0,"-",n,9,sep="")
tt
data.frame(count=c(tt))

Beware that empty groups are silently zapped, though.

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907




More information about the R-help mailing list