mardi 21 août 2018

ifelse test selecting a single value instead of two

First, I created the object sym to lable my plot with M and F instead of Male and Female respectively. sym <- ifelse(students$gender=="male", "M", "F") Then, I used sym as pch to get the plot with M and F symbols appearing in the graph itself.

plot(students$height, students$shoesize, pch=sym) The problem is I am getting the graphs with all "F" symbol and not both "M" and "F". Can anyone identify the problem with the code and suggest the solution? Thanks, Sue

Aucun commentaire:

Enregistrer un commentaire