mapStats will calculate statistics (mean, total, quantiles, variance, and standard deviation) for survey variables, by geography level (e.g. state, county), and optional class variables (such as year, if multiple years are included). The statistics for each variable are then plotted on a shapefile with color codes. Statistics may be calculated either weighted or unweighted. The function calcStats, which is called by mapStats, can also be used on its own to calculate variable statistics.
plotStats creates trellis plot objects that are then printed by print.plotStats. They are called internally from within mapStats. nobsEach is used by jiggleClass to calculate the number of observations in each division.
mapStats computes statistics and quantiles of survey variable(s), with optional class variables, and displays them on a color-coded map. It calls function calcStats which is also usable outside of mapStats.
When using classIntervals to compute classes, occasionally there are rounding errors so that when the data is plotted and the class breaks are used for colors, for instance, the rounding error may cause a value to not be plotted with the right color, or to not be plotted at all. For this reason, we add a small value to each of the break points to accomodate a possible rounding error. This correction is negligible and should not affect plotting.