[R] problem plotting points based on different values

Hrishi lokhande hrishi27n at gmail.com
Wed Jul 13 01:34:29 CEST 2011


Hello Friends,

I am new to R and stuck with a problem.

i have two columns drug_A and drug_B, i have plotted a scatter plot
using the ggplot2 function.

My problem is with the third column, it is the p-value column.

I want to color and size points differently based on the p_value, the
p_value range is between 0<0.0001< 0.001<0.05<1.

I used a script using the ifelse loop, but it considers only two
conditions at one time.

Please tell me a way to fulfill all the conditions.

here is the script:
library(lattice)

 qplot(Drug_A, Drug_B, data=dsmall, size = p_value, colour =
ifelse(p_value > 0, ">0", "<0.0001"),
+ ifelse(p_value1 > 0.001, ">0.001", "<0.01")
+ ifelse(p_value1 > 0.001, ">0.001", "<0.05"
))



More information about the R-help mailing list