dat <- data.frame(
gen = c("G3", "G4", "G1", "G2", "G3", "G4", "G5",
"G1", "G2", "G3", "G4", "G5",
"G1", "G2", "G3", "G4", "G5",
"G1", "G2", "G3", "G4", "G5"),
env = c("E1", "E1", "E1", "E1", "E1", "E1", "E1",
"E2", "E2", "E2", "E2", "E2",
"E3", "E3", "E3", "E3", "E3",
"E4", "E4", "E4", "E4", "E4"),
yield = c(65, 50, NA, NA, 65, 50, 60,
NA, 71, 76, 80, 82,
90, 93, 95, 102, 97,
98, 102, 105, 130, 135))
# How many observations are there for each combination of gen*env?
with( subset(dat, !is.na(yield)) , table(gen,env) )
# Note, if there is no response variable, the two-way filtering is based
# only on the presence of the factor combinations.
dat1 <- con_filter(dat, ~ 4*env / gen)
# If there is a response variable, missing values are dropped first,
# then the two-way filtering is based on the factor combinations.
dat1 <- con_filter(dat, yield ~ 4*env/gen)
dat1 <- con_filter(dat, yield ~ 5*env/ gen)
dat1 <- con_filter(dat, yield ~ 6*gen/ env)
dat1 <- con_filter(dat, yield ~ .8 *env / gen)
dat1 <- con_filter(dat, yield ~ .8* gen / env)
dat1 <- con_filter(dat, yield ~ 7 * env / gen)
Run the code above in your browser using DataLab