I am making a scatterplot using two quantitative variables on the axes and I want to differentiate the plot points based on a third categorical variable called group that has four options. (B, I, IB, or BI)
plot(x,y,ylab="Accuracy",xlab="Category Learning Judgement (%)",ylim=c(0,45),xlim=c(0,90), col=group)
When I use this code I get the error message: Error in plot.xy(xy, type, ...) : invalid color name 'B'
Is there a different way to assign shape/colour by a variable?
I know col=ifelse but that seems to only create two groups.
From what I have tried col=c("blue","purple","red","yellow")
separates them into four colours but randomly and not according to the groups I need.
I am using R studio without ggplot.