This is the R Script referenced in the blog post LINK

## "Effortlessly Read Any Rectangular Data"

library(readit)                                                   

## "Linear and Nonlinear Mixed Effects Models"

library(nlme)   

## "Groupwise Statistics, LSmeans, Linear Contrasts, Utilities"

library(doBy)                                                     

## set graphic display

par(mfrow=c(1,3)) 

## acquire dataset  

ab <- as.data.frame(readit("TOYEXAMPLE.xls"))

## generate mean data by subject

amean <- summaryBy(A~group+subject,FUN=mean,data=ab)

## detailed descriptives,  function available on request

stats(amean$A.mean, by=amean$group)

## plot result 1

boxplot(amean$A.mean~amean$group,ylim=c(-8,10))

## do analysis of variance  

summary(aov(A.mean~group,data=amean))      

## detailed descriptives

stats(ab$A,by=ab$group)                                           

stats(ab$B,by=ab$group)      

## plot result 2

boxplot(A~group,data=ab,ylim=c(-8,10))   

 ## plot result 3

boxplot(B~group,data=ab,ylim=c(-8,10)) 

## do mixed effects modeling 1

a.1 <- lme(A~group,random=~1|subject,data=ab)      

 ## do mixed effects modeling 2

b.1 <- lme(B~group,random=~1|subject,data=ab)                    

summary(a.1)     

summary(b.1)