########## ## # Reading the data into R: ff <- tempfile() cat(file=ff, " 1 1 A 31 2 1 B 39.5 3 1 C 30.5 1 2 B 34 2 2 C 24.5 3 2 A 28 1 3 C 15 2 3 A 25.5 3 3 B 31 ", sep=" ") options(scipen=999) # suppressing scientific notation wheatLS <- read.table(ff, header=FALSE, col.names=c("location", "orientation", "variety", "yield")) # Note we could also save the data columns into a file and use a command such as: # wheatLS <- read.table(file = "z:/stat_516/filename.txt", header=FALSE, col.names = c("location", "orientation", "variety", "yield")) attach(wheatLS) # Making "location", "orientation" and "variety" factors: location <- factor(location) orientation <- factor(orientation) variety <- factor(variety) # The data frame called wheatLS is now created. #########