oswaldosantos / ggsn

R package to add north symbols and scale bars to maps created with ggplot or ggmap
http://oswaldosantos.github.io/ggsn/
GNU General Public License v2.0
161 stars 9 forks source link

ggproto compatibility error #23

Closed aakarner closed 6 years ago

aakarner commented 6 years ago

I've installed ggsn 0.4.6 and ggplot2 2.2.1.9000. When I try to run the example code:

library(ggsn); library(sf)
dsn <- system.file('extdata', package = 'ggsn')

# Map in geographic coordinates
map <- st_read(dsn, 'sp', quiet = TRUE)

ggm1 +
    blank() +
    north(map) +
    scalebar(map, dist = 5, dd2km = TRUE, model = 'WGS84')

I get:

Error: GeomCustomAnn was built with an incompatible version of ggproto.
Please reinstall the package that provides this extension.

My session info:

R version 3.4.2 (2017-09-28)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Attached base packages:
[1] grid      stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] sf_0.5-5           ggsn_0.4.6         ggplot2_2.2.1.9000
oswaldosantos commented 6 years ago

What version of ggmap are you using?

aakarner commented 6 years ago

Looks like 2.6.1.

oswaldosantos commented 6 years ago

I am not being able to reproduce your error neither in ubuntu nor in windows. Your definition of ggm1 is as the following?

(ggm1 <- ggplot(map, aes(fill = nots)) +
        geom_sf())
aakarner commented 6 years ago

Yes, that's right.

I just tried it on a different windows computer with the exact same packages installed and it worked as expected without the error - I'm not sure precisely what that implies.

oswaldosantos commented 6 years ago

I don't either. I would reinstall R and theses packages. If you do it, let me know if that fix the problem.

aakarner commented 6 years ago

Reinstalling ggmap, ggplot2, and sf fixed the problem.