Skip to content

Commit

Permalink
fix more small issues for cran submit
Browse files Browse the repository at this point in the history
  • Loading branch information
alamstein-trulia committed Oct 27, 2014
1 parent af67994 commit 3d3e978
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 10 deletions.
7 changes: 4 additions & 3 deletions R/county.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ CountyChoropleth = R6Class("CountyChoropleth",
clip = function()
{
# remove regions not on the map before doing the merge
self$user.df = self$user.df[self$user.df$region %in% county.regions$region, ]

data(county.regions, package="choroplethrMaps", envir=environment())

self$user.df = self$user.df[self$user.df$region %in% county.regions$region, ]
self$user.df$state = merge(self$user.df, county.regions, sort=FALSE, all.X=TRUE, by.x="region", by.y="region")$state.name
self$user.df = self$user.df[self$user.df$state %in% private$zoom, ]
self$user.df$state = NULL
Expand All @@ -62,6 +62,7 @@ CountyChoropleth = R6Class("CountyChoropleth",
#' match the names of states as they appear in the "region" column of ?state.regions.
#'
#' @examples
#' \dontrun{
#' # demonstrate default parameters - visualization using 7 equally sized buckets
#' data(df_pop_county)
#' county_choropleth(df_pop_county, title="US 2012 County Population Estimates", legend="Population")
Expand Down Expand Up @@ -89,7 +90,7 @@ CountyChoropleth = R6Class("CountyChoropleth",
#' }
#' df_pop_county$value = df_pop_county$str
#' county_choropleth(df_pop_county, title="Which counties have more than 1M people?")

#' }
#' @export
#' @importFrom Hmisc cut2
#' @importFrom stringr str_extract_all
Expand Down
4 changes: 2 additions & 2 deletions R/zip.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ ZipMap = R6Class("CountyChoropleth",
self$warn = FALSE

# load zip code data
data(zipcode, package="zipcode")
data(zipcode, package="zipcode", envir=environment())

# only include states
zipcode = zipcode[zipcode$state %in% state.abb, ]
Expand All @@ -51,7 +51,7 @@ ZipMap = R6Class("CountyChoropleth",
# support e.g. users just viewing states on the west coast
clip = function() {
# user.df has zip codes, but subsetting happens at the state level
data(zipcode, package="zipcode")
data(zipcode, package="zipcode", envir=environment())
# zipcode to state abbreviation
self$user.df$state = merge(self$user.df, zipcode, sort=FALSE, all.x=TRUE, by.x="region", by.y="zip")$state
# state abbrevoation to "region" - lowercase full state name
Expand Down
2 changes: 1 addition & 1 deletion man/CountryChoropleth.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
\name{CountryChoropleth}
\alias{CountryChoropleth}
\title{An R6 object for creating country-level choropleths.}
\format{\preformatted{Class 'R6ClassGenerator' <environment: 0x7fee57225a38>
\format{\preformatted{Class 'R6ClassGenerator' <environment: 0x7fde3ed3f6e8>
- attr(*, "name")= chr "CountryChoropleth_generator"
}}
\usage{
Expand Down
2 changes: 1 addition & 1 deletion man/CountyChoropleth.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
\name{CountyChoropleth}
\alias{CountyChoropleth}
\title{Create a county-level choropleth}
\format{\preformatted{Class 'R6ClassGenerator' <environment: 0x7fee572435f0>
\format{\preformatted{Class 'R6ClassGenerator' <environment: 0x7fde3ed01a78>
- attr(*, "name")= chr "CountyChoropleth_generator"
}}
\usage{
Expand Down
2 changes: 1 addition & 1 deletion man/StateChoropleth.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
\name{StateChoropleth}
\alias{StateChoropleth}
\title{Create a state-level choropleth}
\format{\preformatted{Class 'R6ClassGenerator' <environment: 0x7fee57260c30>
\format{\preformatted{Class 'R6ClassGenerator' <environment: 0x7fde3ecb66e8>
- attr(*, "name")= chr "StateChoropleth_generator"
}}
\usage{
Expand Down
2 changes: 1 addition & 1 deletion man/USAChoropleth.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
\alias{USAChoropleth}
\title{Normal choropleth that draws Alaska and Hawaii as insets.
In addition to a columns named "region" and "value", also requires a column named "state".}
\format{\preformatted{Class 'R6ClassGenerator' <environment: 0x7fee57285c30>
\format{\preformatted{Class 'R6ClassGenerator' <environment: 0x7fde3ec01558>
- attr(*, "name")= chr "USAChoropleth_generator"
}}
\usage{
Expand Down
2 changes: 1 addition & 1 deletion man/ZipMap.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
\name{ZipMap}
\alias{ZipMap}
\title{Create a county-level choropleth}
\format{\preformatted{Class 'R6ClassGenerator' <environment: 0x7fee572f1bc0>
\format{\preformatted{Class 'R6ClassGenerator' <environment: 0x7fde3eae23b8>
- attr(*, "name")= chr "CountyChoropleth_generator"
}}
\usage{
Expand Down
2 changes: 2 additions & 0 deletions man/county_choropleth.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ in the choroplethrMaps package for an object which can help you coerce your regi
into the required format.
}
\examples{
\dontrun{
# demonstrate default parameters - visualization using 7 equally sized buckets
data(df_pop_county)
county_choropleth(df_pop_county, title="US 2012 County Population Estimates", legend="Population")
Expand Down Expand Up @@ -53,4 +54,5 @@ for (i in 1:nrow(df_pop_county))
df_pop_county$value = df_pop_county$str
county_choropleth(df_pop_county, title="Which counties have more than 1M people?")
}
}

0 comments on commit 3d3e978

Please sign in to comment.