precip {datasets}R Documentation

Annual Precipitation in Selected US Cities

Description

The yearly amount of precipitation (rainfall) in inches, averaged over the 30-year period 1941–1970, for each of 70 United States (and Puerto Rico) cities.

Usage

precip

Format

A named vector of length 70.

Note

The dataset version before R 4.6.0 had typos in the names "Pittsburgh" and "Bismarck", and before R 3.3.3 also in "Cincinnati". The examples show how to recreate these versions.

Source

Statistical Abstracts of the United States, 1975, p. 192.

References

McNeil D (1977). Interactive Data Analysis: A Practical Primer. John Wiley & Sons. ISBN 978-0471026310.

Examples

require(stats); require(graphics)
dotchart(precip[order(precip)], main = "precip data")
title(sub = "Average annual precipitation (in.)")

## Recreate pre-4.6.0 version of the dataset with typos in 2 names
precip.2 <- setNames(precip, local({
    nms <- names(precip)
    nms[nms == "Pittsburgh"] <- "Pittsburg"
    nms[nms == "Bismarck"] <- "Bismark"
    nms
}))
## Recreate original, pre-3.3.3 version of the dataset with one more typo
precip.O <- setNames(precip.2,
    replace(names(precip.2), names(precip.2) == "Cincinnati", "Cincinati"))

stopifnot(
    all(precip == precip.2), all(precip == precip.O), # just name changes
    setequal(match(c("Bismarck", "Cincinnati", "Pittsburgh"), names(precip)),
             c(45, 46, 52)),
    identical(names(precip)[-c(45, 46, 52)], names(precip.O)[-c(45, 46, 52)])
)

[Package datasets version 4.6.0 Index]