I'm making a plot of Y vs X for some discrete points in R. There is a third variable Z that has a value of either A or B, so I want to identify the third variable by pch in the plot. I can do the following.
plot(X, Y, pch=c(3,4)[Z])
However, I don't know whether Z=="A" is assigned to 3 or 4 in this case. How do I specify that Z=="A" is plotted as 4 and that Z=="B" is plotted as 3?
Thanks in advance.