M. Aberle M. Aberle - 1 year ago 88
R Question

Read and assign pch values from .csv

I have a rather large data set (.csv), in which one column includes the preferred pch value for plotting points in R.

So far the code

pch = c(21,21,21,21,23,23,23,23)[unclass(MSP_SI_output.df$Group_ID)],
is working, however isn't ideal.

Is there a way to read the preferred pch values in the .csv file and assign them accordingly in the plot? For instance, the pch values are located at

Your help is greatly appreciated.

Answer Source

Are you looking for something like this?

a = data.frame(x = c(1,2,3,4),y = c(3,4,5,6), z = c(20,21,22,23))
> a
  x y  z
1 1 3 20
2 2 4 21
3 3 5 22
4 4 6 23

plot(a$x, a$y, pch = a$z)

enter image description here

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download