[R] colour coded dotchart

Rolf Turner rolf.turner at xtra.co.nz
Sun Jun 9 03:32:44 CEST 2013

On 09/06/13 01:21, Marco Bianchi wrote:
> Dear R-Users,
> I have a vector x <- 1:10 and I would like to produce a dotchart where the
> colour of the dot is black if x <= 5 and red otherwise.
> If I use
> x <- 1:10
> dotchart(x, col="black")
> then all dots are obviously of black colour. Has anybody in the mailing
> list already dealt with a similar task and found a solution?


     ccc <- ifelse(x<=5,"black","red")

You need to get the hang of reading the online help.  The information
required is actually there in ?dotchart --- it's just tersely and obscurely
expressed.  A certain degree of optimism is required.  You need to
***believe*** that the information is there; then ask yourself "What
could they possibly mean by what they have written that would tell
me what I need to know?".

This is how one should interpret the exhortation "RTFM" when it is
inflicted upon one.

After a few millennia it gets easier! :-)


         Rolf Turner

More information about the R-help mailing list