A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pdil/usmap/issues/11 below:

Add ability to only display certain states in county map · Issue #11 · pdil/usmap · GitHub

The county map should be able to display only counties in certain states using the include parameter.

For example,

plot_usmap("counties", include = c("NJ", "PA", "NY"))

This can be fixed at this location in usmap.R:

if (length(include) > 0) {
  if (regions_ %in% c("counties", "county")) {
    df <- df[df$fips %in% include, ]
  } else {
    df <- df[df$full %in% include | df$abbr %in% include | df$fips %in% include, ]
  }
}

The body of the if statement should be changed to:

if (length(include) > 0) {
  df <- df[df$full %in% include | df$abbr %in% include | df$fips %in% include, ]
}

This should work because both the county and state map files have columns fips, full, and abbr.

Updating this function also has the added side-effect of allowing users to specify any combination of states and counties to include using either FIPS code, state abbreviation, state name, or a mixture of the three.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4