I'm new to R. I'm trying to create a boxplot for two different categories, however the results of those two categories are complied in the same variable. I've used the count function to order the variables so they align with the category they are for.
I would like to create two side-by-side boxplots in R using the same variable. The image contains the code I'm trying to use and the error message I receive. Image of my attempt
1 Answer
The "~" in your boxplot() function plots one variable against another (the first variable on the y-axis and the second on the x-axis). For a boxplot the x variable might be categorical.
You might try:
par(mfrow = c(1, 2))
boxplot(QuestionTwo$seizure[1:28])
boxplot(QuestionTwo$seizure[29:59])