Skip to content
Prev 26237 / 398502 Next

Excluding levels in table and xtabs

On Thu, 12 Dec 2002, Michael Friendly wrote:

            
It doesn't work for me (R1.6.1)

R> a<-factor( rep(c("A","B","C"),10))
R> a
 [1] A B C A B C A B C A B C A B C A B C A B C A B C A B C A B C
Levels: A B C
a
 A  B  C
10 10 10
a
 A  B  C
10 10 10
Warning message:
NAs introduced by coercion


and in addition it loses empty levels
a
 A  B  C  D  E
10 10 10  0  0
a
 A  B  C
10 10 10


I agree that the fix needs to be done, though.



	-thomas