[R] three short questions

Marc Schwartz MSchwartz at medanalytics.com
Fri Jul 11 20:05:30 CEST 2003

On Fri, 2003-07-11 at 12:27, J.R. Lockwood wrote:
> > 
> > This is my first message to the list, and I've got three "basic" questions:
> > 
> > How could I insert comments in a file with commands to be used as source in R?
> use the pound sign "#"
> > 
> > Is it possible to quickly display a window with all the colors available in 
> > colors()? How?
> > 
> I've got such a thing on my web page, though it may be dated
> http://www.rand.org/methodology/stat/members/lockwood/downloads/R-built-in-colors.pdf
> > I'm displaying points, but they overlap, wether points() uses triangles, 
> > bullets or whatever. Is it possible to change (diminish) the size of the 
> > symbols? 
> > 
> yes; use "pch" to change symbols and "cex" to change sizes of symbols.
> See the help page for "par"

A couple other possibilities on your third query, depending upon the
nature of your data and the type of plot you are using:

1. Adjust the limits of the x and/or y axis in your plot to enhance the
separation of the points. Generally, this can be done with the 'xlim'
and/or 'ylim' arguments to your plotting function. For example, see
?plot.default for more information.

2. You can try to use jitter() [ie. plot(jitter(x), jitter(y))] if you
have a lot of points that overlap at common coordinates. This introduces
a level of 'noise' to the x and/or y values and can result in a level of
dispersion of these points. See ?jitter for more information. This can
result in a visual "clustering" of points, so keep that in mind.

Be aware that each of the above can impact in a positive or deleterious
fashion, the visual presentation and interpretation of your data so
proceed with caution.


Marc Schwartz

More information about the R-help mailing list