data <- expand.grid(
rep = 1:4,
nitrogen = c("N0", "N40", "N80", "N120"),
phosphorus = c("P0", "P30", "P60")
)
data$yield <- rnorm(nrow(data), 1200, 150)
anova_factorial(data, response = "yield",
factor1 = "nitrogen", factor2 = "phosphorus",
replication = "rep")
Run the code above in your browser using DataLab