Indeed, tapply is what I needed. To clarify Phils' question, what I needed was
tapply(x, list(cut.grp1, cut.grp2), function(z) table(z))
On Mon, Jan 31, 2011 at 4:50 PM, Bert Gunter wrote:
> ?tapply is the basic R function for this. There are many other packages
> (e.g. plyr) and functions (e.
Rajarshi -
It's not clear to me what you mean by "the distribution of
levels obs.". Does
as.data.frame(table(x$obs,cut.grp1,cut.grp2))
give you something like what you want?
- Phil Spector
Statistical Computi
Hi, I have a data.frame that has a categorical variable, for which I
would like to look at the distribution of levels of this variable,
based on a grouping of two other variables.
As an example:
x <- data.frame(obs=sample(c('low', 'high'),100, replace=TRUE),
grp1=sample(1:10, 100, replace=TRUE),
3 matches
Mail list logo