From martin.lenze@to.com  Sun Aug  5 19:03:32 2001
From: martin.lenze@to.com (martin.lenze@to.com)
Date: Sun, 5 Aug 2001 20:03:32 +0200 (MET DST)
Subject: [Rd] xtabs, drop.unused.levels (PR#1041)
Message-ID: <200108051803.UAA11343@pubhealth.ku.dk>

Full_Name: Martin Lenze
Version: 1.3.0 22.06.2001
OS: win32,x86
Submission from: (NULL) (194.221.251.1)


As a newbie I'm not sure, whether this is a bug, but I don't know how to get
around this behaviour:
> x <- list("A"=rep(c(1:5),30),
+ "B"=c(rep(letters[1:3],30),rep(letters[2:4],20)))
> y <- as.data.frame(x)
> xtabs(~A+B,y)
   B
A   a  b  c d
  1 6 10 10 4
  2 6 10 10 4
  3 6 10 10 4
  4 6 10 10 4
  5 6 10 10 4
> y <- subset(y,B!="d")
> xtabs(~A+B,y,drop.unused.levels=TRUE)
   B
A   a  b  c d
  1 6 10 10 0
  2 6 10 10 0
  3 6 10 10 0
  4 6 10 10 0
  5 6 10 10 0

I'd expect "xtabs" to drop "d".

Kindest regards
M. Lenze


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


[Rd] xtabs, drop.unused.levels (PR#1041)
martin.lenze@to.com