[R] Plotting numbers at a specified decimal length on a plot()
Matthew Dubins
matt.dubins at utoronto.ca
Sun Sep 23 19:50:06 CEST 2007
Hi there,
I want to figure out how to plot means, with 2 decimal places, of any Y
variable on a scatterplot according to any X variable (which obviously
should have limited scope). I already figured out how to plot the
means, but without limiting their precision to 2 decimal places. This
is the code I used once I had the scatterplot drawn:
text(c(1990, 1992, 1994, 1996, 1998, 1999, 2000, 2001, 2002, 2003), 25,
mean.yrly.closures$values, cex=.7)
It's a plot of school closures by Year. The closures variable is
labeled "values" in the "mean.yrly.closures" data set. I managed to
*display* the mean.yrly.closures data set with a precision of 2 decimal
places (options(digits=2)), but then once I plotted the numbers, they
showed up with many decimal places.
It would be nice to figure this out so that I don't have to rely on
Excel to make changes to the precision!
Thanks,
Matthew Dubins
More information about the R-help
mailing list