[R] Plot using different symbols depending on value.

Roger Bivand Roger.Bivand at nhh.no
Tue Jan 21 13:47:03 CET 2003

On Tue, 21 Jan 2003, Morten Sickel wrote:

> I am making a plot from R indicating an average, min and max value for a
> number of sample types. as horizontal lines with the sample types on the
> y-axis. (see http://home.newmedia.no/sickel/R.html for the plot and code) In
> some cases, the min value is the detection limit, and I would like to
> indicate that bu using a <, rather than the usual | I use for indicating the
> value.
> I am plotting each of the values using:
>   points(low[s],s+offset,col=i/3,pch='I')
> Is it some kind of inline if, iif(cond,true,false), function in R? I have
> looked for it but not found it.

Maybe ifelse(test, yes, no), for a value of the same shape as test?

pch=ifelse(test, "I", "<") should work for points, I think.

> Regards
> Morten
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Breiviksveien 40, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93
e-mail: Roger.Bivand at nhh.no

More information about the R-help mailing list