Better than pretty

Pretty R is a syntax formatter for R, it generates highlighted and properly indented R code suitable for including in an HTML document.  Better yet, all the R keywords are linked back to an online reference manual at!  Check it out.

# multiple comparison with aov 
s <- read.table("dogFoodSales.txt",header=T)
# fit the ANOVA model and perform post hoc test (Tukey's HSD)
print( summary( smodel <- aov(sales ~ location, data=s) ) )
print( TukeyHSD(smodel,"location", ordered=TRUE) )
# check residuals for normality
# check for homogeneity of variance
print(bartlett.test(sales ~ location))
# just in case, verify with nonparametric test
print(kruskal.test(sales ~ location))

Tip from the R Bloggers.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: