[R] test for nested factors

J. R. M. Hosking jh910 at juno.com
Tue Jun 5 15:37:01 CEST 2007


Tim Bergsma wrote:
> Is there a conventional way to test for nested factors?  I.e., if 'a' 
> and 'b' are lists of same-length factors, does each level specified by 
> 'a' correspond to exactly one level specified by 'b'?

all( tapply(b, a, function(x) length(unique(x))==1 ))


J. R. M. Hosking



More information about the R-help mailing list