I've just started learning R in a statistics course and started learning the different plots.
One exercise requires us to plot two groups of data into a dot-plot, but I'm struggling to add the second group of data to it. I'm using the dotplot() function, and the two data groups are vectors (I think).
I'm not entirely sure on the lingo yet, so please bear with me.
smokers <- c(69.3, 56.0, 22.1, 47.6, 53.2, 48.1, 52.7, 34.4, 60.2, 43.8, 23.2, 13.8)
nonsmokers <- c(28.6, 25.1, 26.4, 34.9, 29.8, 28.4, 38.5, 30.2, 30.6, 31.8, 41.6, 21.1, 36.0, 37.9, 13.9)
dotplot(smokers, col = "blue", pch = 19)
points(nonsmokers, col = "red", pch = 18)
The result is a dotplot of the smoker-data, but the red points for nonsmokers aren't added to the plot.
How do I add the points to the plot, or are there better ways to do it?
PS. The two groups must be on the same line according to the problem.
Edit 1: This is the lattice package. I'd loaded it on another script and forgot.