data <- matrix(scan(),ncol=3,byrow=TRUE) 1 1 142.3 1 1 144.0 2 1 134.9 2 1 146.3 3 1 148.6 3 1 156.5 4 1 152. 4 1 151.4 1 2 142.9 1 2 147.4 2 2 125.9 2 2 127.6 3 2 135.5 3 2 138.9 4 2 142.9 4 2 142.3 data table74 <- data.frame(data) colnames(table74) <- c("day","method","trig") rm(data) table74 table74$day <- as.factor(table74$day) table74$method <- as.factor(table74$method) # get the ANOVA table aov(trig ~ day + method + day:method, data = table74) # gives variance component estimates like Proc MIXED library(lme4) table74.lme1 <- lmer(trig ~ method + (1|day) + (1|day:method), data = table74) summary(table74.lme1) # Alternatively, the afex library calls lmer and other functions to give results fairly # similar to those in Proc MIXED library(afex) table74.afex1 <- mixed(trig ~ method + (1|day) + (1|day:method), data = table74) summary(table74.afex1) nice(table74.afex1) lsmeans(table74.afex1, ~method)