Code from Wednesday's lecture - mlloyd23/bio211_JAN2018 GitHub Wiki


seed.data<-read.table("Seeds.txt", header=TRUE)
hist(seed.data$Distance)
hist(seed.data$Time)

head(seed.data)

sub<-subset(seed.data, Seeds %in% c("1","2","3","4"))

#Transformation on only one column
sq.rt<-sqrt(sub$Distance)
sq.rt<-sqrt(sub)#WRONG!
head(sq.rt)

#CBIND!
new.df<-cbind(sub,sq.rt)

head(new.df)
#in the new.df, new.df$Distance is your non-transformed data
#and new.df$sq.rt is your transformed data

#Need something to be a factor? do that now
new.df$Seeds<-as.factor(new.df$Seeds)

#Use new.df in either parametric or non-parametric tests
#JUST CHANGE THE COLUMN TO THE DATA YOU WANT!

mod.aov<-aov(sq.rt~Seeds, data = new.df)
summary(mod.aov)

kruskal.test(Distance~Seeds, data=new.df)