I'm teaching a class using RStudio Cloud, and it's been going well so far. But today, we were doing some stuff with spatial data (a similar set of code is available here: https://www.amelia.mn/sds236/MakingMaps.html) and when we got to the leaflet piece, everyone's R sessions crashed, losing everything in their Environment and their History
I think everyone was working in my STAT360 workspace (Posit Cloud) and we got a variety of error messages. One interesting/weird feature is that after the crash, the sf library could no longer be loaded into most of their new sessions. Here's an error message:
> library(sf)
Error: package or namespace load failed for ‘sf’:
.onLoad failed in loadNamespace() for 'sf', details:
call: get(genname, envir = envir)
error: object 'group_map' not found
group_map is a dplyr function, which I think has been recently updated, as has sf. Also, sf has to be able to link to GEOS 3.6.1, GDAL 2.1.3, PROJ 4.9.3. I can't log into the cloud account, of course, so it's hard to tell what's loaded. Could you post
What makes me think I did it is that the code was working for me earlier when it was just me, but once I let my students loose we started having problems. Here's the session info:
> sessionInfo()
R version 3.5.2 (2018-12-20)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.5 LTS
Matrix products: default
BLAS: /usr/lib/atlas-base/atlas/libblas.so.3.0
LAPACK: /usr/lib/atlas-base/atlas/liblapack.so.3.0
locale:
[1] LC_CTYPE=C.UTF-8 LC_NUMERIC=C LC_TIME=C.UTF-8
[4] LC_COLLATE=C.UTF-8 LC_MONETARY=C.UTF-8 LC_MESSAGES=C.UTF-8
[7] LC_PAPER=C.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] lubridate_1.7.4
loaded via a namespace (and not attached):
[1] compiler_3.5.2 magrittr_1.5 tools_3.5.2 Rcpp_1.0.0
[5] stringi_1.2.4 knitr_1.21 stringr_1.3.1 xfun_0.4
I can't reproduce the problem, of course, without the code, but I've been running sf without difficulty. Here's what I have after loading the same packages:
sessionInfo()
R version 3.5.3 (2019-03-11)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.2 LTS
What would worry me most is Ubuntu, R, dplyr, Rcpp, rstudioapi, compiler ... just say everything that's not current. I'm not a cloud user, so I don't know whether you, as a user, can do all of that.
I suspect it has to do with the size of the SpatialPolygonsDataFrame we were creating, which is pretty large. What I don't understand is why crashing R then makes sf not work. I'll try to create a more reproducible issue!
Have you tried upgrading to the current CRAN or dev version of dplyr (0.8)? I remember having some weirdness like you’re describing after upgrading sf while having an older version of dplyr installed. As @technocrat mentioned, the reference to dplyr::group_map() in the error message makes me think it’s related to this issue.
Sorry you encountered issues using cloud. I think the R session crashes are memory related. I looked up a couple recent projects in your space and it does look like a number of them hit the 1GB memory limit earlier in the day. This would result in a session crash similar to what you describe.
You should also talk to the RStudio folk about an academic license with more generous limits; I know they have academic rates on their commercial products, so maybe ...