Skip to content

Commit c23988c

Browse files
author
smeyer
committed
fix 2 typos in names(precip)
git-svn-id: https://svn.r-project.org/R/trunk@88388 00db46b3-68df-0310-9c12-caf00c1e9a41
1 parent 11414de commit c23988c

File tree

4 files changed

+44
-18
lines changed

4 files changed

+44
-18
lines changed

doc/NEWS.Rd

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,9 @@
169169
\item It is now possible to convert \emph{to} \code{"snpc"} units
170170
via, e.g., \code{grid::convertWidth()}, fixing \PR{18915}. Thanks to
171171
\I{Trevor Davis}.
172+
173+
\item The \code{precip} dataset had typos in the names
174+
\code{"Bismarck"} and \code{"Pittsburgh"} (\PR{18895}).
172175
}
173176
}
174177
}

src/library/datasets/data/precip.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ structure(c(67, 54.7, 7, 48.5, 14, 17.2, 20.7, 13, 43.4, 40.2, 38.9, 54.5,
1212
"Baltimore", "Boston", "Detroit", "Sault Ste. Marie", "Duluth",
1313
"Minneapolis/St Paul", "Jackson", "Kansas City", "St Louis", "Great Falls",
1414
"Omaha", "Reno", "Concord", "Atlantic City", "Albuquerque", "Albany",
15-
"Buffalo", "New York", "Charlotte", "Raleigh", "Bismark", "Cincinnati",
15+
"Buffalo", "New York", "Charlotte", "Raleigh", "Bismarck", "Cincinnati",
1616
"Cleveland", "Columbus", "Oklahoma City", "Portland", "Philadelphia",
17-
"Pittsburg", "Providence", "Columbia", "Sioux Falls", "Memphis",
17+
"Pittsburgh", "Providence", "Columbia", "Sioux Falls", "Memphis",
1818
"Nashville", "Dallas", "El Paso", "Houston", "Salt Lake City", "Burlington",
1919
"Norfolk", "Richmond", "Seattle Tacoma", "Spokane", "Charleston", "Milwaukee",
2020
"Cheyenne", "San Juan"))

src/library/datasets/man/precip.Rd

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,31 @@
2525
New York: Wiley.
2626
}
2727
\note{
28-
The dataset version up to Nov.16, 2016 had a typo in \code{"Cincinnati"}'s
29-
name. The examples show how to recreate that version.
28+
The dataset version before \R 4.6.0 had typos in the names
29+
\code{"Pittsburgh"} and \code{"Bismarck"}, and before \R 3.3.3 also in
30+
\code{"Cincinnati"}. The examples show how to recreate these versions.
3031
}
3132
\examples{
32-
require(graphics)
33+
require(stats); require(graphics)
3334
dotchart(precip[order(precip)], main = "precip data")
3435
title(sub = "Average annual precipitation (in.)")
3536

36-
## Old ("wrong") version of dataset (just name change):
37-
precip.O <- local({
38-
p <- precip; names(p)[names(p) == "Cincinnati"] <- "Cincinati" ; p })
39-
stopifnot(all(precip == precip.O),
40-
match("Cincinnati", names(precip)) == 46,
41-
identical(names(precip)[-46], names(precip.O)[-46]))
37+
## Recreate pre-4.6.0 version of the dataset with typos in 2 names
38+
precip.2 <- setNames(precip, local({
39+
nms <- names(precip)
40+
nms[nms == "Pittsburgh"] <- "Pittsburg"
41+
nms[nms == "Bismarck"] <- "Bismark"
42+
nms
43+
}))
44+
## Recreate original, pre-3.3.3 version of the dataset with one more typo
45+
precip.O <- setNames(precip.2,
46+
replace(names(precip.2), names(precip.2) == "Cincinnati", "Cincinati"))
47+
48+
stopifnot(
49+
all(precip == precip.2), all(precip == precip.O), # just name changes
50+
setequal(match(c("Bismarck", "Cincinnati", "Pittsburgh"), names(precip)),
51+
c(45, 46, 52)),
52+
identical(names(precip)[-c(45, 46, 52)], names(precip.O)[-c(45, 46, 52)])
53+
)
4254
}
4355
\keyword{datasets}

tests/Examples/datasets-Ex.Rout.save

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3166,16 +3166,27 @@ nms body_mass sex year
31663166
>
31673167
> ### ** Examples
31683168
>
3169-
> require(graphics)
3169+
> require(stats); require(graphics)
31703170
> dotchart(precip[order(precip)], main = "precip data")
31713171
> title(sub = "Average annual precipitation (in.)")
31723172
>
3173-
> ## Old ("wrong") version of dataset (just name change):
3174-
> precip.O <- local({
3175-
+ p <- precip; names(p)[names(p) == "Cincinnati"] <- "Cincinati" ; p })
3176-
> stopifnot(all(precip == precip.O),
3177-
+ match("Cincinnati", names(precip)) == 46,
3178-
+ identical(names(precip)[-46], names(precip.O)[-46]))
3173+
> ## Recreate pre-4.6.0 version of the dataset with typos in 2 names
3174+
> precip.2 <- setNames(precip, local({
3175+
+ nms <- names(precip)
3176+
+ nms[nms == "Pittsburgh"] <- "Pittsburg"
3177+
+ nms[nms == "Bismarck"] <- "Bismark"
3178+
+ nms
3179+
+ }))
3180+
> ## Recreate original, pre-3.3.3 version of the dataset with one more typo
3181+
> precip.O <- setNames(precip.2,
3182+
+ replace(names(precip.2), names(precip.2) == "Cincinnati", "Cincinati"))
3183+
>
3184+
> stopifnot(
3185+
+ all(precip == precip.2), all(precip == precip.O), # just name changes
3186+
+ setequal(match(c("Bismarck", "Cincinnati", "Pittsburgh"), names(precip)),
3187+
+ c(45, 46, 52)),
3188+
+ identical(names(precip)[-c(45, 46, 52)], names(precip.O)[-c(45, 46, 52)])
3189+
+ )
31793190
>
31803191
>
31813192
>

0 commit comments

Comments
 (0)