Difficult to Reproduce Choroplethr Bug: Can You Help?

Since November 2017 I have received three bug reports from users who see this error when running any command in the choroplethr package:

Theme element panel.border missing
  Error in if (theme$panel.ontop) { : argument is of length zero

Normally when someone reports a choroplethr bug that I cannot reproduce I recommend they do the following:

  1. Update to the latest version of R and RStudio.
  2. Type “update.packages(ask=FALSE)” to get the latest version of each package.
  3. Restart R and try again.

However, each of the three users has tried this it has not solved their problem.

It appears that the bug is at least somewhat OS dependent. I am running the following version of R:

R version 3.4.3 (2017-11-30)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.3

and I cannot reproduce the bug. The users who report the bug have these configurations:

version R version 3.4.3 (2017-11-30)
 system x86_64, linux-gnu    

version R version 3.4.3 (2017-11-30)
 system x86_64, linux-gnu

R version 3.4.1 (2017-06-30)
 Platform: x86_64-w64-mingw32/x64 (64-bit)
 Running under: Windows Server 2008 R2 x64 (build 7601) Service Pack 1

Because I do not have access to a machine configuration that produces the bug, I am limited in my ability to debug this.

A google search for this error shows that issues #179 (a linux machine) and #185 (no OS specified) in the ggmap package both report the same error and were filed at roughly the same time that I started receiving these error reports. These issues seem to have been resolved by this change. However, since I am not able to reproduce the error on my own machine, I am reluctant to make any updates to the choroplethr code base based on what I see in that commit.

If you are able to shed some light on what is going on with this bug, then please leave a comment below.

The following code seems to reproduce the bug:

library(choroplethr)
library(choroplethrMaps)
data(df_pop_state)
state_choropleth(df_pop_state)

Update

Thank you for everyone who provided test results in the comments. I have been able to narrow down the issue to occurring in the development version of ggplot2. That is, the OS issue appears to be a red herring. I am now working on the issue.

19 comments
Charles Smith says February 20, 2018

The 3 lines of code above work fine on Windows 10, v. 1709 using R 3.4.3 in R Studio 1.1.383

    Marco Sandri says February 22, 2018

    I can reproduce the error on my Windows 7 with R 3,4,2.
    Session info ——————————————————————
    setting value
    version R version 3.4.2 (2017-09-28)
    system x86_64, mingw32
    ui Rgui
    language (EN)
    collate English_United Kingdom.1252
    tz Europe/Berlin
    date 2018-02-23

    Packages ———————————————————————-
    package * version date source
    acepack 1.4.1 2016-10-29 CRAN (R 3.4.1)
    acs * 2.1.2 2017-10-10 CRAN (R 3.4.3)
    assertthat 0.2.0 2017-04-11 CRAN (R 3.4.2)
    backports 1.1.2 2017-12-13 CRAN (R 3.4.3)
    base * 3.4.2 2017-09-28 local
    base64enc 0.1-4 2017-10-15 local
    bindr 0.1 2016-11-13 CRAN (R 3.4.1)
    bindrcpp 0.2 2017-06-17 CRAN (R 3.4.1)
    checkmate 1.8.5 2017-10-24 CRAN (R 3.4.2)
    choroplethr * 3.6.1 2017-04-16 CRAN (R 3.4.3)
    choroplethrMaps * 1.0.1 2017-01-31 CRAN (R 3.4.3)
    class 7.3-14 2015-08-30 CRAN (R 3.4.2)
    classInt 0.1-24 2017-04-16 CRAN (R 3.4.2)
    cluster 2.0.6 2017-03-10 CRAN (R 3.4.2)
    colorspace 1.3-2 2016-12-14 CRAN (R 3.4.2)
    compiler 3.4.2 2017-09-28 local
    data.table 1.10.4-3 2017-10-27 CRAN (R 3.4.2)
    datasets * 3.4.2 2017-09-28 local
    DBI 0.7 2017-06-18 CRAN (R 3.4.2)
    devtools 1.13.4 2017-11-09 CRAN (R 3.4.3)
    digest 0.6.15 2018-01-28 CRAN (R 3.4.3)
    dplyr 0.7.4 2017-09-28 CRAN (R 3.4.2)
    e1071 1.6-8 2017-02-02 CRAN (R 3.4.1)
    foreign 0.8-69 2017-06-22 CRAN (R 3.4.2)
    Formula 1.2-2 2017-07-10 CRAN (R 3.4.1)
    geosphere 1.5-7 2017-11-05 CRAN (R 3.4.2)
    ggmap 2.6.1 2016-01-23 CRAN (R 3.4.1)
    ggplot2 2.2.1.9000 2018-01-03 Github (tidyverse/ggplot2@4ee6c94)
    glue 1.2.0 2017-10-29 CRAN (R 3.4.2)
    graphics * 3.4.2 2017-09-28 local
    grDevices * 3.4.2 2017-09-28 local
    grid 3.4.2 2017-09-28 local
    gridExtra 2.3 2017-09-09 CRAN (R 3.4.2)
    gtable 0.2.0 2016-02-26 CRAN (R 3.4.2)
    Hmisc 4.1-1 2018-01-03 CRAN (R 3.4.3)
    htmlTable 1.11.2 2018-01-20 CRAN (R 3.4.3)
    htmltools 0.3.6 2017-04-28 CRAN (R 3.4.2)
    htmlwidgets 1.0 2018-01-20 CRAN (R 3.4.3)
    httr 1.3.1 2017-08-20 CRAN (R 3.4.3)
    jpeg 0.1-8 2014-01-23 CRAN (R 3.4.0)
    knitr 1.19 2018-01-29 CRAN (R 3.4.3)
    labeling 0.3 2014-08-23 CRAN (R 3.4.1)
    lattice 0.20-35 2017-03-25 CRAN (R 3.4.2)
    latticeExtra 0.6-28 2016-02-09 CRAN (R 3.4.1)
    lazyeval 0.2.1 2017-10-29 CRAN (R 3.4.2)
    magrittr 1.5 2014-11-22 CRAN (R 3.4.2)
    mapproj 1.2-5 2017-06-08 CRAN (R 3.4.1)
    maps 3.2.0 2017-06-08 CRAN (R 3.4.1)
    maptools 0.9-2 2017-03-25 CRAN (R 3.4.2)
    Matrix 1.2-12 2017-11-16 CRAN (R 3.4.2)
    memoise 1.1.0 2017-04-21 CRAN (R 3.4.2)
    methods * 3.4.2 2017-09-28 local
    munsell 0.4.3 2016-02-13 CRAN (R 3.4.2)
    nnet 7.3-12 2016-02-02 CRAN (R 3.4.2)
    pillar 1.1.0 2018-01-14 CRAN (R 3.4.3)
    pkgconfig 2.0.1 2017-03-21 CRAN (R 3.4.1)
    plyr 1.8.4 2016-06-08 CRAN (R 3.4.2)
    png 0.1-8 2017-10-15 local
    proto 1.0.0 2016-10-29 CRAN (R 3.4.1)
    R6 2.2.2 2017-06-17 CRAN (R 3.4.2)
    rappdirs 0.3.1 2016-03-28 CRAN (R 3.4.1)
    RColorBrewer 1.1-2 2014-12-07 CRAN (R 3.4.1)
    Rcpp 0.12.15 2018-01-20 CRAN (R 3.4.3)
    reshape2 1.4.3 2017-12-11 CRAN (R 3.4.3)
    rgdal 1.2-16 2017-11-21 CRAN (R 3.4.2)
    RgoogleMaps 1.4.1 2016-09-18 CRAN (R 3.4.1)
    rjson 0.2.15 2014-11-03 CRAN (R 3.4.1)
    rlang 0.1.6 2017-12-21 CRAN (R 3.4.3)
    rpart 4.1-12 2018-01-12 CRAN (R 3.4.3)
    rstudioapi 0.7 2017-09-07 CRAN (R 3.4.1)
    scales 0.5.0.9000 2017-08-29 Github (hadley/scales@d767915)
    sf 0.6-0 2018-01-06 CRAN (R 3.4.3)
    sp 1.2-7 2018-01-19 CRAN (R 3.4.3)
    splines 3.4.2 2017-09-28 local
    stats * 3.4.2 2017-09-28 local
    stringi 1.1.6 2017-11-17 CRAN (R 3.4.2)
    stringr * 1.2.0 2017-02-18 CRAN (R 3.4.2)
    survival 2.41-3 2017-04-04 CRAN (R 3.4.1)
    tibble 1.4.2 2018-01-22 CRAN (R 3.4.3)
    tigris 0.6.2 2018-01-04 CRAN (R 3.4.3)
    tools 3.4.2 2017-09-28 local
    udunits2 0.13 2016-11-17 CRAN (R 3.4.1)
    units 0.5-1 2018-01-08 CRAN (R 3.4.3)
    utils * 3.4.2 2017-09-28 local
    uuid 0.1-2 2015-07-28 CRAN (R 3.4.1)
    WDI 2.4 2013-08-20 CRAN (R 3.4.1)
    withr 2.1.1.9000 2017-12-22 Github (jimhester/withr@df18523)
    XML * 3.98-1.9 2017-06-19 CRAN (R 3.4.1)

Anibal Ayala Raso says February 20, 2018

Dear Ari, I run the code above and no problem at all on ubuntu 16.04 based machine and R 3.4.3

I must say that in a fresh install there is a lot of dependency problems. But all have solution.

Regards,

Anibal.

stoney says February 20, 2018

I am not able to reproduce the bug on Ubuntu 17.10, r 3.4.3, rstudio 1.1.423, choroplethr 3.6.1, acs 2.1.2, stringr 1.2.0, XML 3.98.1.9 ( ggmap 2.6.1 ). I will test this on Windows 10 later.

Thomas Hütter says February 20, 2018

Windows Server version 2008 R2 should be equivalent to Windows 7 on a workstation, if that helps. Sorry, can’t assist you with that one…

Adalberto da Silva says February 20, 2018

Dear Ari,
the code works pefectly here on Windows 7 Ultimate, version 6.1 (build 7601: Service Pack 1), R version 3.4.3 (2017-11-30) — “Kite-Eating Tree”, Platform: x86_64-w64-mingw32/x64 (64-bit), and RStudio, Version 1.1.423.
Everything updated as today.

Garrett (@GarrettRMooney) says February 20, 2018

I was able to replicate the bug on Ubuntu 16.04. I don’t have time to debug immediately, but I’d be glad to help out.


devtools::session_info()
#> Session info -------------------------------------------------------------
#> setting value
#> version R version 3.4.3 (2017-11-30)
#> system x86_64, linux-gnu
#> ui X11
#> language en_US
#> collate en_US.UTF-8
#> tz posixrules
#> date 2018-02-20
#> Packages -----------------------------------------------------------------
#> package * version date source
#> backports 1.1.2 2017-12-13 CRAN (R 3.4.3)
#> base * 3.4.3 2017-12-01 local
#> compiler 3.4.3 2017-12-01 local
#> datasets * 3.4.3 2017-12-01 local
#> devtools 1.13.5 2018-02-18 cran (@1.13.5)
#> digest 0.6.15 2018-01-28 CRAN (R 3.4.3)
#> evaluate 0.10.1 2017-06-24 CRAN (R 3.4.1)
#> graphics * 3.4.3 2017-12-01 local
#> grDevices * 3.4.3 2017-12-01 local
#> htmltools 0.3.6 2017-04-28 CRAN (R 3.4.1)
#> knitr 1.20 2018-02-20 CRAN (R 3.4.3)
#> magrittr 1.5.0 2018-02-08 Github (tidyverse/magrittr@0a76de2)
#> memoise 1.1.0 2018-02-08 Github (r-lib/memoise@611cfad)
#> methods * 3.4.3 2017-12-01 local
#> Rcpp 0.12.15 2018-01-20 CRAN (R 3.4.3)
#> rmarkdown 1.8 2017-11-17 CRAN (R 3.4.3)
#> rprojroot 1.3-2 2018-02-09 Github (krlmlr/rprojroot@23519a0)
#> stats * 3.4.3 2017-12-01 local
#> stringi 1.1.7 2018-02-09 Github (gagolews/stringi@8255eb6)
#> stringr 1.3.0.9000 2018-02-19 Github (tidyverse/stringr@0e06524)
#> tools 3.4.3 2017-12-01 local
#> utils * 3.4.3 2017-12-01 local
#> withr 2.1.1.9000 2017-12-22 Github (jimhester/withr@df18523)
#> yaml 2.1.16 2017-12-12 CRAN (R 3.4.3)

    Ari Lamstein says February 20, 2018

    Thank you Garrett! So far you are the only person who has been able to replicate the bug!

      Garrett (@GarrettRMooney) says February 20, 2018

      No problem. If there is something that you would like for me to try you can message me on twitter on grep your mailing list for ‘gmooney’.

      Garrett (@GarrettRMooney) says February 21, 2018

      I just noticed that `reprex::reprex` filtered the output of my `session_info` above. Using the CRAN ggplot2 resolved the bug for me.

        Ari Lamstein says February 21, 2018

        Great! Thank you for your help!

George Girton says February 20, 2018

Hi, in attempting to reproduce bug, I noticed following error message with your 3 lines code:
# Error: Package choroplethrMaps is needed for this function to work. Please install it.

Perhaps the error being received is spurious in the Linux R setups you describe & instead choroplethrMaps needs to be installed.

After installing the choroplethrMaps package, I was able to reproduce your nice map, no bug.
> sessionInfo()
R version 3.4.3 (2017-11-30)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.3

    Ari Lamstein says February 20, 2018

    Thank you for catching that error George! Unfortunately, I think that the bug people are reporting is unrelated to that mistake of mine 🙁 The most common error report has been people going through my free course “Learn to Map Census Data in R”. And all the exercises in those courses have been carefully vetted

Thomas Hütter says February 21, 2018

OK, got my hands on a Windows 8.1 Pro system today: no bug, no error message.

Session info —————————————————————————————————————
setting value
version R version 3.4.3 (2017-11-30)
system x86_64, mingw32
ui RStudio (1.1.338)
language (EN)
collate German_Germany.1252
tz Europe/Berlin
date 2018-02-21

    Thomas Hütter says February 21, 2018

    Same with the 1.1.423 version of RStudio.
    Thanks for making me notice the update 😉

Michelle Evans says February 21, 2018

I was able to reproduce the bug. Session info:

R version 3.4.3 (2017-11-30)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.3
Rstudio Version 1.1.383

Let me know if you’d like me to dig into it more! I do have the dev version of ggplot2 installed, which could may causing the panel.border error? Just a thought.

    Ari Lamstein says February 21, 2018

    That’s interesting. Can you please try it with the CRAN version of ggplot2 installed and report back?

ggamba says February 21, 2018

I was also able to reproduce the error on ubuntu 16.04 (actually Mint 18.2).

I did play around ggmap, switching between CRAN and Github versions (I have the latter atm).

I’d be happy to help!

> devtools::session_info()
Session info ————–
setting value
version R version 3.4.3 (2017-11-30)
system x86_64, linux-gnu
ui RStudio (1.1.423)
language en_US
collate en_US.UTF-8
tz Europe/San_Marino
date 2018-02-21

Packages —————-
package * version date source
acepack 1.4.1 2016-10-29 CRAN (R 3.4.2)
acs * 2.1.2 2017-10-10 CRAN (R 3.4.3)
assertthat 0.2.0 2017-04-11 CRAN (R 3.4.1)
backports 1.1.2 2017-12-13 CRAN (R 3.4.3)
base * 3.4.3 2017-12-01 local
base64enc 0.1-3 2015-07-28 CRAN (R 3.4.1)
bindr 0.1 2016-11-13 CRAN (R 3.4.1)
bindrcpp 0.2 2017-06-17 CRAN (R 3.4.1)
bitops 1.0-6 2013-08-17 CRAN (R 3.4.1)
checkmate 1.8.5 2017-10-24 CRAN (R 3.4.2)
choroplethr * 3.6.1 2017-04-16 CRAN (R 3.4.3)
choroplethrMaps * 1.0.1 2017-01-31 CRAN (R 3.4.3)
class 7.3-14 2015-08-30 CRAN (R 3.4.2)
classInt 0.1-24 2017-04-16 CRAN (R 3.4.2)
cluster 2.0.6 2017-03-16 CRAN (R 3.4.2)
colorspace 1.3-2 2016-12-14 CRAN (R 3.4.1)
compiler 3.4.3 2017-12-01 local
data.table 1.10.4-3 2017-10-27 cran (@1.10.4-)
datasets * 3.4.3 2017-12-01 local
DBI 0.7-12 2017-09-27 Github (rstats-db/DBI@f8c97f2)
devtools 1.13.4 2017-11-09 CRAN (R 3.4.2)
digest 0.6.15 2018-01-28 cran (@0.6.15)
dplyr 0.7.4 2017-09-28 cran (@0.7.4)
e1071 1.6-8 2017-02-02 CRAN (R 3.4.2)
foreign 0.8-69 2017-06-21 CRAN (R 3.4.1)
Formula 1.2-2 2017-07-10 CRAN (R 3.4.2)
geosphere 1.5-7 2017-11-05 CRAN (R 3.4.2)
ggmap 2.7 2018-01-24 Github (dkahle/ggmap@924b075)
ggplot2 2.2.1.9000 2018-01-22 Github (tidyverse/ggplot2@401511e)
glue 1.2.0 2017-10-29 CRAN (R 3.4.2)
graphics * 3.4.3 2017-12-01 local
grDevices * 3.4.3 2017-12-01 local
grid 3.4.3 2017-12-01 local
gridExtra 2.3 2017-09-09 CRAN (R 3.4.1)
gtable 0.2.0 2016-02-26 CRAN (R 3.4.1)
Hmisc 4.1-1 2018-01-03 CRAN (R 3.4.3)
htmlTable 1.11.1 2017-12-27 CRAN (R 3.4.3)
htmltools 0.3.6 2017-04-28 CRAN (R 3.4.1)
htmlwidgets 1.0 2018-01-20 cran (@1.0)
httr 1.3.1 2017-08-20 CRAN (R 3.4.1)
jpeg 0.1-8 2014-01-23 CRAN (R 3.4.2)
jsonlite 1.5 2017-06-01 CRAN (R 3.4.1)
knitr 1.18 2017-12-27 CRAN (R 3.4.3)
labeling 0.3 2014-08-23 CRAN (R 3.4.1)
lattice 0.20-35 2017-03-25 CRAN (R 3.4.2)
latticeExtra 0.6-28 2016-02-09 CRAN (R 3.4.2)
lazyeval 0.2.1 2017-10-29 CRAN (R 3.4.2)
magrittr 1.5 2014-11-22 CRAN (R 3.4.1)
mapproj 1.2-5 2017-06-08 CRAN (R 3.4.2)
maps 3.2.0 2017-06-08 CRAN (R 3.4.2)
maptools 0.9-2 2017-03-25 CRAN (R 3.4.3)
Matrix 1.2-12 2017-11-16 CRAN (R 3.4.2)
memoise 1.1.0 2017-04-21 CRAN (R 3.4.3)
methods * 3.4.3 2017-12-01 local
mongolite 1.5 2018-01-03 CRAN (R 3.4.3)
munsell 0.4.3 2016-02-13 CRAN (R 3.4.1)
nnet 7.3-12 2016-02-02 CRAN (R 3.4.1)
pillar 1.0.1 2017-11-27 cran (@1.0.1)
pkgconfig 2.0.1 2017-03-21 CRAN (R 3.4.1)
plyr 1.8.4 2016-06-08 CRAN (R 3.4.1)
png 0.1-7 2013-12-03 CRAN (R 3.4.2)
proto 1.0.0 2016-10-29 CRAN (R 3.4.2)
R6 2.2.2 2017-06-17 CRAN (R 3.4.1)
rappdirs 0.3.1 2016-03-28 CRAN (R 3.4.1)
RColorBrewer 1.1-2 2014-12-07 CRAN (R 3.4.1)
Rcpp 0.12.15 2018-01-20 cran (@0.12.15)
reshape2 1.4.3 2017-12-11 cran (@1.4.3)
rgdal 1.2-16 2017-11-21 CRAN (R 3.4.3)
RgoogleMaps 1.4.1 2016-09-18 CRAN (R 3.4.2)
rjson 0.2.15 2014-11-03 cran (@0.2.15)
rlang 0.1.6.9003 2018-01-22 Github (tidyverse/rlang@4b4483a)
rpart 4.1-11 2017-04-21 CRAN (R 3.4.2)
rstudioapi 0.7 2017-09-07 CRAN (R 3.4.2)
scales 0.5.0.9000 2017-12-11 Github (hadley/scales@d767915)
sf 0.6-0 2018-01-06 CRAN (R 3.4.3)
sp 1.2-6 2018-01-05 cran (@1.2-6)
splines 3.4.3 2017-12-01 local
stats * 3.4.3 2017-12-01 local
stringi 1.1.6 2017-11-17 CRAN (R 3.4.2)
stringr * 1.2.0 2017-02-18 CRAN (R 3.4.1)
survival 2.41-3 2017-04-04 CRAN (R 3.4.2)
tibble 1.4.1 2017-12-25 cran (@1.4.1)
tigris 0.6.2 2018-01-04 CRAN (R 3.4.3)
tools 3.4.3 2017-12-01 local
udunits2 0.13 2016-11-17 CRAN (R 3.4.2)
units 0.5-1 2018-01-08 CRAN (R 3.4.3)
utils * 3.4.3 2017-12-01 local
uuid 0.1-2 2015-07-28 CRAN (R 3.4.3)
WDI 2.4 2013-08-20 CRAN (R 3.4.3)
withr 2.1.1.9000 2018-01-08 Github (jimhester/withr@df18523)
XML * 3.98-1.9 2017-06-19 CRAN (R 3.4.2)
yaml 2.1.16 2017-12-12 CRAN (R 3.4.3)

    Ari Lamstein says February 21, 2018

    Are you able to reproduce the bug if you only use the CRAN version of ggplot2 and the other tidyverse packages?

Comments are closed