Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
arilamstein committed Sep 29, 2015
1 parent d0e658b commit 2493990
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 31 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
@@ -1,6 +1,6 @@
Package: choroplethrZip
Type: Package
Title: Shapefile, Metadata and Visualization Functions for US Zip Code Tabulated Areas (ZCTAs).
Title: Shapefile, Metadata and Visualization Functions for US Zip Code Tabulated Areas (ZCTAs)
Version: 1.4.0
Author: Ari Lamstein
Maintainer: Ari Lamstein <arilamstein@gmail.com>
Expand Down
35 changes: 22 additions & 13 deletions R/zip_choropleth.R
Expand Up @@ -140,35 +140,44 @@ ZipChoropleth = R6Class("ZipChoropleth",
#'
#' # zooming on a state
#' zip_choropleth(df_pop_zip,
#' state_zoom="new york",
#' title="2012 New York State ZCTA Population Estimates",
#' legend="Population")
#' state_zoom = "new york",
#' title = "2012 New York State ZCTA Population Estimates",
#' legend = "Population")
#'
#' # adding a reference map
#' zip_choropleth(df_pop_zip,
#' state_zoom = "new york",
#' title = "2012 New York State ZCTA Population Estimates",
#' legend = "Population",
#' reference_map = TRUE)
#'
#' # viewing on a set of counties
#' # note we use numeric county FIPS codes
#' nyc_fips = c(36005, 36047, 36061, 36081, 36085)
#' zip_choropleth(df_pop_zip,
#' county_zoom=nyc_fips,
#' title="2012 New York City ZCTA Population Estimates",
#' legend="Population")
#' county_zoom = nyc_fips,
#' title = "2012 New York City ZCTA Population Estimates",
#' legend = "Population")
#'
#' # zooming in on a few ZIPs
#' manhattan_les = c("10002", "10003", "10009")
#' manhattan_ues = c("10021", "10028", "10044", "10128")
#' zip_choropleth(df_pop_zip,
#' zip_zoom=c(manhattan_les, manhattan_ues),
#' title="2012 Lower and Upper East Side ZCTA Population Estimates",
#' legend="Population")
#' zip_zoom = c(manhattan_les, manhattan_ues),
#' title = "2012 Lower and Upper East Side ZCTA Population Estimates",
#' legend = "Population")
#'
#' # zooming in on an entire Metropolitan Statistical Area (MSA)
#' zip_choropleth(df_pop_zip,
#' msa_zoom="New York-Newark-Jersey City, NY-NJ-PA",
#' title="2012 NY-Newark-Jersey City MSA\nZCTA Population Estimates",
#' legend="Population")
#' msa_zoom = "New York-Newark-Jersey City, NY-NJ-PA",
#' title = "2012 NY-Newark-Jersey City MSA\nZCTA Population Estimates",
#' legend = "Population")
#'
#' # showing the entire country
#' # note: this takes a few minutes to run
#' zip_choropleth(df_pop_zip, title="2012 US ZCTA Population Estimates", legend="Population")
#' zip_choropleth(df_pop_zip,
#' title = "2012 US ZCTA Population Estimates",
#' legend = "Population")
#' }
#' @seealso \url{https://www.census.gov/geo/reference/zctas.html} for an explanation of ZCTAs and how they relate to US Zip Codes.
#' @export
Expand Down
2 changes: 1 addition & 1 deletion inst/tests/test-zip_choropleth.R
Expand Up @@ -54,4 +54,4 @@ test_that("msa_zoom returns ggplot", {
# expect_is(zip_choropleth(df_pop_zip,
# title="2012 USA\nZip Population Estimates",
# legend="Population"), "ggplot")
})
#})
35 changes: 22 additions & 13 deletions man/zip_choropleth.Rd
Expand Up @@ -53,35 +53,44 @@ data(df_pop_zip)

# zooming on a state
zip_choropleth(df_pop_zip,
state_zoom="new york",
title="2012 New York State ZCTA Population Estimates",
legend="Population")
state_zoom = "new york",
title = "2012 New York State ZCTA Population Estimates",
legend = "Population")

# adding a reference map
zip_choropleth(df_pop_zip,
state_zoom = "new york",
title = "2012 New York State ZCTA Population Estimates",
legend = "Population",
reference_map = TRUE)

# viewing on a set of counties
# note we use numeric county FIPS codes
nyc_fips = c(36005, 36047, 36061, 36081, 36085)
zip_choropleth(df_pop_zip,
county_zoom=nyc_fips,
title="2012 New York City ZCTA Population Estimates",
legend="Population")
county_zoom = nyc_fips,
title = "2012 New York City ZCTA Population Estimates",
legend = "Population")

# zooming in on a few ZIPs
manhattan_les = c("10002", "10003", "10009")
manhattan_ues = c("10021", "10028", "10044", "10128")
zip_choropleth(df_pop_zip,
zip_zoom=c(manhattan_les, manhattan_ues),
title="2012 Lower and Upper East Side ZCTA Population Estimates",
legend="Population")
zip_zoom = c(manhattan_les, manhattan_ues),
title = "2012 Lower and Upper East Side ZCTA Population Estimates",
legend = "Population")

# zooming in on an entire Metropolitan Statistical Area (MSA)
zip_choropleth(df_pop_zip,
msa_zoom="New York-Newark-Jersey City, NY-NJ-PA",
title="2012 NY-Newark-Jersey City MSA\\nZCTA Population Estimates",
legend="Population")
msa_zoom = "New York-Newark-Jersey City, NY-NJ-PA",
title = "2012 NY-Newark-Jersey City MSA\\nZCTA Population Estimates",
legend = "Population")

# showing the entire country
# note: this takes a few minutes to run
zip_choropleth(df_pop_zip, title="2012 US ZCTA Population Estimates", legend="Population")
zip_choropleth(df_pop_zip,
title = "2012 US ZCTA Population Estimates",
legend = "Population")
}
}
\seealso{
Expand Down
5 changes: 2 additions & 3 deletions tests/test-all.R
@@ -1,4 +1,3 @@
#library(testthat)
#library(choroplethrZip)
library(testthat)

#test_package("choroplethrZip")
test_package("choroplethrZip")

0 comments on commit 2493990

Please sign in to comment.