I need to construct a data frame and an interaction plot from the following table of means. However, the plot is not coming out correctly. I am using the basic R graphics package to make the plot. Any help is greatly appreciated.
Column | Gas Flow Rate | |
---|---|---|
Temperature | Low | High |
120 | 10 | 13 |
180 | 12 | 18 |
ibrary("graphics")
data.2=data.frame(gas.rate.1=c(Low= rep(c(10,12), each = 2)),
gas.rate.2=c(High= rep(c(13,18), times = 2)),
temp = c(120,180))
data.2
#> gas.rate.1 gas.rate.2 temp
#> Low1 10 13 120
#> Low2 10 18 180
#> Low3 12 13 120
#> Low4 12 18 180
nchar(data.2)
#> gas.rate.1 gas.rate.2 temp
#> 17 17 21
interaction.plot(x.factor=data.2$gas.rate.1,
trace.factor=data.2$gas.rate.2,
response=data.2$temp,
fun = mean,
ylab = "Temperature",
xlab = "Gas Flow",
col = c("purple", "blue"),
lty = 1,
lwd = 2,
trace.label = "Gas")
Created on 2021-10-10 by the reprex package (v2.0.1)