[R] pooling categories in a table
Peter Dalgaard BSA
p.dalgaard at biostat.ku.dk
Tue Apr 9 11:52:22 CEST 2002
Peter Dalgaard BSA <p.dalgaard at biostat.ku.dk> writes:
> Robin Hankin <r.hankin at auckland.ac.nz> writes:
>
> > Peter Dalgaard writes:
> >
> > >
> > > data(UCBAdmissions)
> > > DF <- as.data.frame(UCBAdmissions)
> > > DF$Dept <- factor(c(1,2,2,3,4,5)[DF$Dept],
> > > labels=c("A","B+C","D","E","F"))
> > > xtabs(Freq~.,DF)
> > >
> >
> >
> > This is simply brilliant. I found it very very instructive; any
> > chance of adding it to the examples section of xtabs()' help file?
>
> Not at this stage with 1.5.0 in feature freeze, I think. (Help page
> examples are "features" because they become part of the test suite. An
> unfortunate example could break the test suite on some platforms and
> destabilize the whole process. Of course *this* particular case is
> very likely harmless, but we need hard rules.) We can do it for
> r-devel afterwards.
And BTW, the canonical way of joining factor levels escaped me last
night:
levels(DF$Dept) <- c("A","B+C","B+C","D","E","F")
is usually clearer, unless you have inordinately long level labels.
--
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
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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