Skip to content

Commit

Permalink
add examples
Browse files Browse the repository at this point in the history
  • Loading branch information
alamstein-trulia committed Oct 25, 2014
1 parent b759c85 commit 7bff234
Show file tree
Hide file tree
Showing 11 changed files with 82 additions and 32 deletions.
28 changes: 0 additions & 28 deletions .Rhistory

This file was deleted.

2 changes: 2 additions & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ License: BSD_3_clause + file LICENSE
URL: https://github.com/trulia/choroplethrMaps/,
https://groups.google.com/forum/#!forum/choroplethr
BugReports: https://github.com/trulia/choroplethrMaps/issues
Suggests:
ggplot2
11 changes: 11 additions & 0 deletions R/country.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,22 @@
#' @docType data
#' @name country.map
#' @usage data(country.map)
#' @examples
#' \dontrun{
#' # render the map with ggplot2
#' library(ggplot2)
#'
#' data(country.map)
#' ggplot(country.map, aes(long, lat, group=group)) + geom_polygon()
#' }
NULL

#' Names of all regions on the country.map data.frame. A data.frame that includes both English names and
#' their iso2c equivalents.
#' @name country.regions
#' @usage data(country.regions)
#' @docType data
#' @examples
#' data(country.regions)
#' head(country.regions)
NULL
11 changes: 11 additions & 0 deletions R/county.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@
#' @references Taken from the US Census 2010
#' Cartographic Boundary shapefiles page (https://www.census.gov/geo/maps-data/data/tiger-cart-boundary.html) in May 2014.
#' The resolutions is 20m (20m = 1:20,000,000).
#' @examples
#' \dontrun{
#' # render the map with ggplot2
#' library(ggplot2)
#'
#' data(county.map)
#' ggplot(county.map, aes(long, lat, group=group)) + geom_polygon()
#' }
NULL

#' A data.frame consisting of the name of each region in the map county.map as well as their FIPS codes and state names.
Expand All @@ -25,4 +33,7 @@ NULL
#' @docType data
#' @name county.regions
#' @usage data(county.regions)
#' @examples
#' data(county.regions)
#' head(county.regions)
NULL
17 changes: 15 additions & 2 deletions R/state.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,27 @@
#' @references Taken from the US Census 2010
#' Cartographic Boundary shapefiles page (https://www.census.gov/geo/maps-data/data/tiger-cart-boundary.html) in May 2014.
#' The resolutions is 20m (20m = 1:20,000,000).
#' @examples
#' \dontrun{
#' # render the map with ggplot2
#' library(ggplot2)
#'
#' data(state.map)
#' ggplot(state.map, aes(long, lat, group=group)) + geom_polygon()
#' }
NULL

#' A data.frame consisting of each region on the map state.map plus their postal code abbreviations and FIPS codes.
#' A data.frame consisting of each region on the map state.map plus their postal code
#' abbreviations and FIPS codes.
#'
#' choroplethr requires you to use the naming convention in the "region" column (i.e. all lowercase, full name).
#' choroplethr requires you to use the naming convention in the "region" column
#' (i.e. all lowercase, full name).
#'
#' @docType data
#' @name state.regions
#' @usage data(state.regions)
#' @references Taken from http://www.epa.gov/envirofw/html/codes/state.html
#' @examples
#' data(state.regions)
#' head(state.regions)
NULL
9 changes: 9 additions & 0 deletions man/country.map.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ column "sovereignt".
Note that due to the resolution of the map (1:110m, or 1 cm=1,100 km), small countries are not
represented on this map. See ?country.names for a list of all countries represented on the map.
}
\examples{
\dontrun{
# render the map with ggplot2
library(ggplot2)

data(country.map)
ggplot(country.map, aes(long, lat, group=group)) + geom_polygon()
}
}
\references{
Taken from http://www.naturalearthdata.com/downloads/110m-cultural-vectors/
}
Expand Down
4 changes: 4 additions & 0 deletions man/country.regions.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,8 @@ data(country.regions)
Names of all regions on the country.map data.frame. A data.frame that includes both English names and
their iso2c equivalents.
}
\examples{
data(country.regions)
head(country.regions)
}

9 changes: 9 additions & 0 deletions man/county.map.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@ Puerto Rico 2) remove islands off of Alaska that
crossed the antimeridian 3) renamed the county "Dona Ana" (which is properly written with a tilde over the
first "n") to "Dona Ana" because R CMD check emits a warning if data contains non-ASCII characters 4) some columns were added for convenience.
}
\examples{
\dontrun{
# render the map with ggplot2
library(ggplot2)

data(county.map)
ggplot(county.map, aes(long, lat, group=group)) + geom_polygon()
}
}
\references{
Taken from the US Census 2010
Cartographic Boundary shapefiles page (https://www.census.gov/geo/maps-data/data/tiger-cart-boundary.html) in May 2014.
Expand Down
4 changes: 4 additions & 0 deletions man/county.regions.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ data(county.regions)
choroplethr requires you to use the naming convention in the "region" column (i.e. the numeric version of
the FIPS code - no leading zero).
}
\examples{
data(county.regions)
head(county.regions)
}
\seealso{
?county.map
}
Expand Down
9 changes: 9 additions & 0 deletions man/state.map.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ was modified using QGIS in order to 1) remove
Puerto Rico and 2) remove islands off of Alaska that
crossed the antimeridian 3) renamed column "STATE" to "region".
}
\examples{
\dontrun{
# render the map with ggplot2
library(ggplot2)

data(state.map)
ggplot(state.map, aes(long, lat, group=group)) + geom_polygon()
}
}
\references{
Taken from the US Census 2010
Cartographic Boundary shapefiles page (https://www.census.gov/geo/maps-data/data/tiger-cart-boundary.html) in May 2014.
Expand Down
10 changes: 8 additions & 2 deletions man/state.regions.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,18 @@
\docType{data}
\name{state.regions}
\alias{state.regions}
\title{A data.frame consisting of each region on the map state.map plus their postal code abbreviations and FIPS codes.}
\title{A data.frame consisting of each region on the map state.map plus their postal code
abbreviations and FIPS codes.}
\usage{
data(state.regions)
}
\description{
choroplethr requires you to use the naming convention in the "region" column (i.e. all lowercase, full name).
choroplethr requires you to use the naming convention in the "region" column
(i.e. all lowercase, full name).
}
\examples{
data(state.regions)
head(state.regions)
}
\references{
Taken from http://www.epa.gov/envirofw/html/codes/state.html
Expand Down

0 comments on commit 7bff234

Please sign in to comment.