From george.leigh at dpi.qld.gov.au  Mon Mar 15 09:29:59 2004
From: george.leigh at dpi.qld.gov.au (george.leigh@dpi.qld.gov.au)
Date: Mon Mar 15 09:29:55 2004
Subject: [Rd] Bug in tapply with factors containing NAs (PR#6672)
Message-ID: <20040315082959.6822EEDDC@slim.kubism.ku.dk>

Full_Name: George Leigh
Version: 1.8.1
OS: Windows 2000
Submission from: (NULL) (203.25.1.208)


The following example gives the correct answer when the first argument of tapply
is a numeric vector, but an incorrect answer when it is a factor.  If the
function used by tapply is "length", the type and contents of the first argument
should make no difference, provided it has the same length as the second
argument.

> x = c(NA, 1)
> y = factor(x)
> tapply(x, y, length)
1 
1 
> tapply(y, y, length)
1 
2 
>


[Rd] Bug in tapply with factors containing NAs (PR#6672)
george.leigh@dpi.qld.gov.au