Aimin Yan wrote:> p factor have 5 levels
> aa factor have 19 levels.
> totally it should have 95 combinations.
> but I just find there are 92 combinations.
> Does anyone know how to code to find what combinations are missed?
Here is an example with fewer factor levels of one way you might do this:
df <- data.frame(p =
rep(c("A","B","C","D"), each=10),
aa = rep(c("Yes","No"), 20))
df$aa <- replace(df$aa, df$p == "D", "No")
table(df)
aa
p No Yes
A 5 5
B 5 5
C 5 5
D 10 0
names(which(with(df, table(interaction(p, aa))) == 0))
[1] "D.Yes"
> Thanks,
>
> Aimin
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
--
Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (M, W, F)
fax: (917) 438-0894