# the matrix function can be used for data sets with only numeric variables data <- matrix(scan(),ncol=2,byrow=TRUE) 1 1 2 1 3 1 5 2 3 2 4 2 6 3 7 3 5 3 data tastetest <- data.frame(data) colnames(tastetest) <- c("taste","treat") rm(data) # remove unneeded objects # we must make sure that treat is a factor, not numeric tastetest$treat <- as.factor(tastetest$treat) boxplot(taste ~ treat, data = tastetest, main = "Taste test data") tastetest.lm <- lm(taste ~ treat, data = tastetest) anova(tastetest.lm) summary(tastetest.lm) x11() # opens a new graphics window on multiple operating systems # windows() # opens a new graphics window under Windows operating system par(mfrow=c(2,2)) plot(tastetest.lm) par(mfrow=c(1,1)) # ------------------------------------------------------------------------------------ # Alternatively, treatment can be defined as a character variable using the scan function: data <- scan(what = list(taste=0,treat=""), multi.line=F) 1 1 2 1 3 1 5 2 3 2 4 2 6 3 7 3 5 3 data tastetest <- data.frame(data)