[R] Package "maps": what is the name of county # 2395?

David Winsemius dwinsemius at comcast.net
Mon Jan 16 18:27:17 CET 2012


On Jan 16, 2012, at 11:11 AM, Dimitri Liakhovitski wrote:

> I am using "maps". I am running the following code to get this list of
> all the counties:
>
> map('county', plot=FALSE)$names
>
> In the output, all counties have first the state listed and then,
> after a comma, the name of the county.
>
> However, county # 2395 (State = south dakota) has no county name.
> Anyone knows what this county is?

This question would seem more appropriate for greater efforts on your  
part:

http://southdakota.hometownlocator.com/counties/

(That was the second hit on a google search:  counties of south dakota )

After:
conames <- scan(what="character")
<and pasting in the selected text>
conames <- c("Aurora", "Beadle", "Bennett", "Bon Homme", "Brookings",
"Brown", "Brule", "Buffalo", "Butte", "Campbell", "Charles Mix",  
"Clark", "Clay", "Codington", "Corson", "Custer", "Davison",
"Day", "Deuel", "Dewey", "Douglas", "Edmunds", "Fall River",
"Faulk", "Grant", "Gregory", "Haakon", "Hamlin", "Hand", "Hanson",
"Harding", "Hughes", "Hutchinson", "Hyde", "Jackson", "Jerauld",
"Jones", "Kingsbury", "Lake", "Lawrence", "Lincoln", "Lyman",
"Marshall", "McCook", "McPherson", "Meade", "Mellette", "Miner",
"Minnehaha", "Moody", "Pennington", "Perkins", "Potter", "Roberts",
"Sanborn", "Shannon", "Spink", "Stanley", "Sully", "Todd", "Tripp",
"Turner", "Union", "Walworth", "Yankton", "Ziebach")

Note: there are three names with spaces that I joined:

 > length(conames)
[1] 66
 > length(map('county', 'south dakota', plot=FALSE)$names)
[1] 67

https://www.google.com/search?q=how+many+counties+in+south+dakota&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a

(Wikipedia confirms there are 66 counties in SD.)

So the answer is apparently ... it's NOT a county. Furthermore efforts  
to plot it fail with an error about faulty settings:

 > map('county', 'south dakota', exact=TRUE)
Error in par(usr = usr) :
   invalid value specified for graphical parameter "usr"

So it's some sort of blank entry in that 'map' database.

 > str(map('county', 'south dakota', exact=TRUE,  plot=FALSE)[[1]])
  num [1:2] -101 -101

str(map('county', 'south dakota,aurora', exact=TRUE,  plot=FALSE)[[1]])
  num [1:20] -98.3 -98.3 NA -98.7 -98.3 ...

I do not see any other blank county listings in 'new jersey' or 'north  
dakota'.

-- 

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list