How to do it...

In this example, we will use a dataset that contains several days of data for a website selling furniture. On each day, 50% of the website users are exposed to each background color (red or blue). Also, within each group, 50% of them are exposed to a classic font type, and 50% of them to a modern font type. The objective is to understand whether these two factors cause any impact on the sales for this website. Finally, if there are differences, we want to characterize them:

  1. Load the data, as follows:
library(dplyr) r = read.csv("./2wayanova.csv")
  1. We need to prepare the ANOVA table via the aov() function. The formula that we will use is Sales ~ Colour + Font + Font*Colour, meaning that we want to model Sales as a function ...

Get R Statistics Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.