A two-way ANOVA can be viewed as the extension of a one-way ANOVA, for the analysis covers more than two categorical variables rather than one. In this recipe, we will discuss how to conduct a two-way ANOVA in R.
mtcars has already been loaded into a data frame within an R session. Since the
interaction.plot functions are originated from the
stats package, make sure the library,
stats, is loaded.
Perform the following steps:
> par(mfrow=c(1,2)) > boxplot(mtcars$mpg~mtcars$gear,subset=(mtcars$am==0),xlab='gear', ylab = "mpg",main='automatic') ...