Skip to content
This repository has been archived by the owner on May 1, 2021. It is now read-only.

README.md example doesn't work, with "Error in zero_range(from) : x must be length 1 or 2". #15

Open
ChuliangXiao opened this issue May 9, 2018 · 2 comments
Assignees

Comments

@ChuliangXiao
Copy link

Library

library(albersusa)
library(sf)
library(sp)
library(rgeos)
library(maptools)
library(ggplot2)
library(ggalt)
library(ggthemes)
library(viridis)
library(scales)

# current verison
packageVersion("albersusa")

US States Map

us <- usa_composite()
us_map <- fortify(us, region="name")

Basemap

gg <- ggplot()
gg <- gg + geom_map(data=us_map, map=us_map,
                    aes(x=long, y=lat, map_id=id),
                    color="#2b2b2b", size=0.1, fill=NA)
gg <- gg + theme_map()

gg + coord_map()

Fill with Population

gg + 
  geom_map(data=us@data, map=us_map,
           aes(fill=pop_2014, map_id=name),
           color="white", size=0.1) +
  coord_proj(us_laea_proj) +
  scale_fill_viridis(name="2014 Populaton Estimates", labels=comma) +
  theme(legend.position="top", 
        legend.key.width=unit(3, "lines"))

Error in zero_range(from) : x must be length 1 or 2

 devtools::session_info('albersusa')
Session info ------------------------------------------------------------------------------------------------------------
 setting  value                       
 version  R version 3.3.0 (2016-05-03)
 system   x86_64, mingw32             
 ui       RStudio (1.1.423)           
 language (EN)                        
 collate  C                           
 tz       America/New_York            
 date     2018-05-09                  

Packages ----------------------------------------------------------------------------------------------------------------
 package   * version date       source                             
 albersusa * 0.3.0   2018-05-04 Github (hrbrmstr/albersusa@82220d3)
 class       7.3-14  2015-08-30 CRAN (R 3.3.0)                     
 classInt    0.2-3   2018-04-16 CRAN (R 3.3.3)                     
 DBI         1.0.0   2018-05-02 CRAN (R 3.3.0)                     
 e1071       1.6-8   2017-02-02 CRAN (R 3.3.3)                     
 foreign   * 0.8-66  2015-08-19 CRAN (R 3.3.0)                     
 graphics  * 3.3.0   2016-05-04 local                              
 grDevices * 3.3.0   2016-05-04 local                              
 grid        3.3.0   2016-05-04 local                              
 lattice   * 0.20-35 2017-03-25 CRAN (R 3.3.3)                     
 magrittr    1.5     2014-11-22 CRAN (R 3.3.3)                     
 maptools  * 0.9-2   2017-03-25 CRAN (R 3.3.3)                     
 MASS        7.3-45  2016-04-21 CRAN (R 3.3.0)                     
 methods   * 3.3.0   2016-05-04 local                              
 Rcpp        0.12.16 2018-03-13 CRAN (R 3.3.3)                     
 rgdal       1.2-18  2018-03-17 CRAN (R 3.3.3)                     
 rgeos     * 0.3-26  2017-10-31 CRAN (R 3.3.3)                     
 sf        * 0.6-1   2018-03-22 CRAN (R 3.3.3)                     
 sp        * 1.2-7   2018-01-19 CRAN (R 3.3.3)                     
 spData      0.2.8.3 2018-03-25 CRAN (R 3.3.3)                     
 stats     * 3.3.0   2016-05-04 local                              
 tools       3.3.0   2016-05-04 local                              
 udunits2    0.13    2016-11-17 CRAN (R 3.3.2)                     
 units       0.5-1   2018-01-08 CRAN (R 3.3.3)                     
 utils     * 3.3.0   2016-05-04 local
@hrbrmstr
Copy link
Owner

hrbrmstr commented May 9, 2018

Thx for giving it a go. I've re-gen'd the README (https://github.com/hrbrmstr/albersusa/blob/master/README.md) and added the output of the session info that was used to generate it. Since it's been used by more than a few people of late, pls dbl check your config with it.

@hrbrmstr hrbrmstr self-assigned this May 9, 2018
@ChuliangXiao
Copy link
Author

Something wrong with coord_proj(us_laea_proj), while it works with coord_map("polyconic")

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants