[R] Two-way tables of data, etc
Prof Brian D Ripley
ripley at stats.ox.ac.uk
Wed Sep 5 08:10:30 CEST 2001
On Wed, 5 Sep 2001, Murray Jorgensen wrote:
> At 06:42 AM 5-09-01 +0100, Prof Brian D Ripley wrote:
>
> >xtabs(content ~ block + treat)
> >
> >is almost what you gave, better labelled.
> >
> >The obvious (to me) tools are xtabs and ftable to flatten arrays.
>
> Yes, excellent. Thank you.
>
> The beginning of the xtabs documentation is a little misleading, though, as it
> runs
Rather, I am mis-using the tool, as I happen to know it does this
(or rather that crosstabs in S-PLUS can be so abused).
Kurt: might it be worth adding an example, e.g.
> data(warpbreaks)
> warpbreaks$replicate <- rep(1:9, len=54)
> ftable(xtabs(breaks ~ wool + tension + replicate, data = warpbreaks))
or maybe
ftable(xtabs(breaks ~ wool + replicate + tension, data = warpbreaks))
or even
tab <- xtabs(breaks ~ wool + replicate + tension, data = warpbreaks)
dimnames(tab)[[2]] <- rep("", 9)
names(dimnames(tab))[2] <- ""
ftable(tab)
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UK Fax: +44 1865 272595
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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