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
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'?
The function below seems to suffice, but I'd be happy to know of a more
succinct solution, if it
On 6/4/07, Tim Bergsma [EMAIL PROTECTED] 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'?
The function below seems to suffice, but I'd be
Here are two functions I wrote, 'is.nested' and 'are.crossed', that check
whether a factor is nested inside antoher one, or if both are crossed:
is.nested - function (factor1,factor2)
{
# only one positive number per line in the f1 * f2 crosstable