geocompx / geocompr

Geocomputation with R: an open source book
https://r.geocompx.org/
Other
1.53k stars 581 forks source link

Code chunk in chapter 2 failing #270

Closed Robinlovelace closed 6 years ago

Robinlovelace commented 6 years ago

Heads-up @Nowosad I think this may be due to the latest CRAN version of tmap. Also cc @mtennekes in case it's of interest:

# second intro plot -----------------------------------------------------------                                              
library(tmap)                                                                                                                
library(rcartocolor)                                                                                                         
#> Warning: package 'rcartocolor' was built under R version 3.5.1
library(spDataLarge)                                                                                                         
library(raster)                                                                                                              
#> Loading required package: sp
#> Warning: package 'sp' was built under R version 3.5.1

# data read ---------------------------------------------------------------                                                  
cla_raster = raster(system.file("raster/srtm.tif", package = "spDataLarge"))                                                 
cat_raster = nlcd                                                                                                            

# colors create -----------------------------------------------------------                                                  
terrain_colors = carto_pal(7, "TealRose")                                                                                    
landcover_cols = c("#476ba0", "#aa0000", "#b2ada3", "#68aa63", "#a58c30", "#c9c977", "#dbd83d", "#bad8ea")                   

# plots create ------------------------------------------------------------                                                  
rast_srtm = tm_shape(cla_raster) + tm_raster(palette = terrain_colors, title = "Elevation (m)", style = "cont") +            
tm_layout(main.title = "A. Continuous data", legend.frame = TRUE, legend.position = c("right", "bottom"))                    

rast_nlcd = tm_shape(cat_raster) + tm_raster(col = "levels", palette = landcover_cols, style = "cat", title = "Land cover") +
tm_layout(main.title = "B. Categorical data", legend.frame = TRUE, legend.position = c("right", "bottom"))                   

tmap_arrange(rast_srtm, rast_nlcd, ncol = 2)                                                                                 
#> Error in get_proj4(x[[shape.id[masterID]]]$projection, as.CRS = TRUE): unused argument (as.CRS = TRUE)

Session info ``` r devtools::session_info() #> Session info ------------------------------------------------------------- #> setting value #> version R version 3.5.0 (2018-04-23) #> system x86_64, mingw32 #> ui RTerm #> language (EN) #> collate English_United Kingdom.1252 #> tz Europe/London #> date 2018-08-10 #> Packages ----------------------------------------------------------------- #> package * version date source #> assertthat 0.2.0 2017-04-11 CRAN (R 3.5.0) #> backports 1.1.2 2017-12-13 CRAN (R 3.5.0) #> base * 3.5.0 2018-04-23 local #> base64enc 0.1-3 2015-07-28 CRAN (R 3.5.0) #> bindr 0.1.1 2018-03-13 CRAN (R 3.5.0) #> bindrcpp 0.2.2 2018-03-29 CRAN (R 3.5.0) #> boot 1.3-20 2017-08-06 CRAN (R 3.5.0) #> class 7.3-14 2015-08-30 CRAN (R 3.5.0) #> classInt 0.2-3 2018-04-16 CRAN (R 3.5.0) #> coda 0.19-1 2016-12-08 CRAN (R 3.5.1) #> codetools 0.2-15 2016-10-05 CRAN (R 3.5.0) #> colorspace 1.3-2 2016-12-14 CRAN (R 3.5.0) #> compiler 3.5.0 2018-04-23 local #> crosstalk 1.0.0 2016-12-21 CRAN (R 3.5.0) #> curl 3.2 2018-03-28 CRAN (R 3.5.0) #> datasets * 3.5.0 2018-04-23 local #> DBI 1.0.0 2018-05-02 CRAN (R 3.5.0) #> deldir 0.1-15 2018-04-01 CRAN (R 3.5.1) #> devtools 1.13.5 2018-02-18 CRAN (R 3.5.0) #> dichromat 2.0-0 2013-01-24 CRAN (R 3.5.0) #> digest 0.6.15 2018-01-28 CRAN (R 3.5.0) #> dplyr 0.7.4 2017-09-28 CRAN (R 3.5.0) #> e1071 1.6-8 2017-02-02 CRAN (R 3.5.0) #> evaluate 0.10.1 2017-06-24 CRAN (R 3.5.0) #> expm 0.999-2 2017-03-29 CRAN (R 3.5.1) #> foreach 1.4.4 2017-12-12 CRAN (R 3.5.0) #> gdalUtils 2.0.1.14 2018-04-23 CRAN (R 3.5.0) #> gdata 2.18.0 2017-06-06 CRAN (R 3.5.1) #> ggplot2 3.0.0 2018-07-03 CRAN (R 3.5.1) #> glue 1.2.0 2017-10-29 CRAN (R 3.5.0) #> gmodels 2.18.1 2018-06-25 CRAN (R 3.5.1) #> graphics * 3.5.0 2018-04-23 local #> grDevices * 3.5.0 2018-04-23 local #> grid 3.5.0 2018-04-23 local #> gtable 0.2.0 2016-02-26 CRAN (R 3.5.0) #> gtools 3.8.1 2018-06-26 CRAN (R 3.5.0) #> htmltools 0.3.6 2017-04-28 CRAN (R 3.5.0) #> htmlwidgets 1.2 2018-04-19 CRAN (R 3.5.0) #> httpuv 1.4.2 2018-05-03 CRAN (R 3.5.0) #> httr 1.3.1 2017-08-20 CRAN (R 3.5.0) #> iterators 1.0.9 2017-12-12 CRAN (R 3.5.0) #> KernSmooth 2.23-15 2015-06-29 CRAN (R 3.5.0) #> knitr 1.20 2018-02-20 CRAN (R 3.5.0) #> later 0.7.2 2018-05-01 CRAN (R 3.5.0) #> lattice 0.20-35 2017-03-25 CRAN (R 3.5.0) #> lazyeval 0.2.1 2017-10-29 CRAN (R 3.5.0) #> leaflet 2.0.1.9000 2018-08-10 Github (rstudio/leaflet@25bbc09) #> LearnBayes 2.15.1 2018-03-18 CRAN (R 3.5.0) #> lwgeom 0.1-4 2018-01-28 CRAN (R 3.5.0) #> magrittr 1.5 2014-11-22 CRAN (R 3.5.0) #> mapview 2.4.0 2018-04-28 CRAN (R 3.5.0) #> MASS 7.3-49 2018-02-23 CRAN (R 3.5.0) #> Matrix 1.2-14 2018-04-13 CRAN (R 3.5.0) #> memoise 1.1.0 2017-04-21 CRAN (R 3.5.0) #> methods * 3.5.0 2018-04-23 local #> mime 0.5 2016-07-07 CRAN (R 3.5.0) #> munsell 0.4.3 2016-02-13 CRAN (R 3.5.0) #> nlme 3.1-137 2018-04-07 CRAN (R 3.5.0) #> pillar 1.2.2 2018-04-26 CRAN (R 3.5.0) #> pkgconfig 2.0.1 2017-03-21 CRAN (R 3.5.0) #> plyr 1.8.4 2016-06-08 CRAN (R 3.5.0) #> png 0.1-7 2013-12-03 CRAN (R 3.5.0) #> promises 1.0.1 2018-04-13 CRAN (R 3.5.0) #> R.methodsS3 1.7.1 2016-02-16 CRAN (R 3.5.0) #> R.oo 1.22.0 2018-04-22 CRAN (R 3.5.0) #> R.utils 2.6.0 2017-11-05 CRAN (R 3.5.0) #> R6 2.2.2 2017-06-17 CRAN (R 3.5.0) #> raster * 2.6-7 2017-11-13 CRAN (R 3.5.0) #> rcartocolor * 0.0.22 2018-02-08 CRAN (R 3.5.1) #> RColorBrewer 1.1-2 2014-12-07 CRAN (R 3.5.0) #> Rcpp 0.12.16 2018-03-13 CRAN (R 3.5.0) #> rgdal 1.3-4 2018-08-03 CRAN (R 3.5.1) #> rgeos 0.3-28 2018-06-08 CRAN (R 3.5.1) #> rlang 0.2.0 2018-02-20 CRAN (R 3.5.0) #> rmarkdown 1.9 2018-03-01 CRAN (R 3.5.0) #> RPostgreSQL 0.6-2 2017-06-24 CRAN (R 3.5.0) #> rprojroot 1.3-2 2018-01-03 CRAN (R 3.5.0) #> satellite 1.0.1 2017-10-18 CRAN (R 3.5.0) #> scales 0.5.0 2017-08-24 CRAN (R 3.5.0) #> sf 0.6-3 2018-05-17 CRAN (R 3.5.1) #> shiny 1.0.5 2017-08-23 CRAN (R 3.5.0) #> sp * 1.3-1 2018-06-05 CRAN (R 3.5.1) #> spData 0.2.9.3 2018-08-10 Github (nowosad/spData@4fc4935) #> spDataLarge * 0.2.7.1 2018-08-10 local #> spdep 0.7-7 2018-04-03 CRAN (R 3.5.1) #> splines 3.5.0 2018-04-23 local #> stats * 3.5.0 2018-04-23 local #> stats4 3.5.0 2018-04-23 local #> stringi 1.1.7 2018-03-12 CRAN (R 3.5.0) #> stringr 1.3.1 2018-05-10 CRAN (R 3.5.1) #> tibble 1.4.2 2018-01-22 CRAN (R 3.5.0) #> tmap * 1.11-2 2018-04-10 CRAN (R 3.5.0) #> tmaptools 2.0-1 2018-08-07 CRAN (R 3.5.1) #> tools 3.5.0 2018-04-23 local #> udunits2 0.13 2016-11-17 CRAN (R 3.5.0) #> units 0.5-1 2018-01-08 CRAN (R 3.5.0) #> utils * 3.5.0 2018-04-23 local #> viridisLite 0.3.0 2018-02-01 CRAN (R 3.5.0) #> webshot 0.5.0 2017-11-29 CRAN (R 3.5.0) #> withr 2.1.2 2018-03-15 CRAN (R 3.5.0) #> XML 3.98-1.13 2018-08-01 CRAN (R 3.5.1) #> xml2 1.2.0 2018-01-24 CRAN (R 3.5.0) #> xtable 1.8-2 2016-02-05 CRAN (R 3.5.0) #> yaml 2.1.19 2018-05-01 CRAN (R 3.5.0) ```
Robinlovelace commented 6 years ago

Closing - was a case of updating packages.