version of v8 on rstudio.cloud lags version required for ggplot2 book code

I'm having students walk through sections of the Hadley Wickham's ggplot2: Elegant Graphics for Data Analysis, and the first code snippet from section 7.2.1:

oz_states <- ozmaps::ozmap_states %>% filter(NAME != "Other Territories")
oz_votes <- rmapshaper::ms_simplify(ozmaps::abs_ced)
#> Registered S3 method overwritten by 'geojsonlint':
#>   method         from 
#>   print.location dplyr

produces the following error on rstudio.cloud:

Error in context_eval(join(src), private$context, serialize) :
Error in V8 context: ReferenceError: Uint8ClampedArray is not defined
at :1:5492
at FlatQueue.ids (:1:3995)
at Object. (:1:4109)
at o (:1:265)
at :1:316
at Object.internal.getBoundsSearchFunction (:1:586891)
at Object.internal.groupPolygonRings (:1:563644)
at GeoJSON.exportPolygonGeom (:1:739932)
at :1:736355
at Array.reduce (native)

One student also got the following warning on trying to load the rmapshaper package mentioned in the snippet:

Warning: v8 Engine is version 3.14.5.9 but version >=6 is required for full functionality. Some rmapshaper functions, notably ms_clip() and ms_erase(), may not work. See https://github.com/jeroen/V8 for help installing a modern version of v8 on your operating system.

Could these be related issues?

Update: One student found a workaround by using

oz_votes <- ozmaps::abs_ced

instead, but I'm not sure what accounts for it working.

Test with

devtools::install_github("jeroen/V8")

from R

1 Like

Thanks, @pjz, I'll try that.

Also you can try:

sudo add-apt-repository ppa:cran/v8
sudo apt-get update
sudo apt-get install libnode-dev

After:
install.packages("V8")

source: https://github.com/jeroen/V8

Please, give me if it work

Regars

This is for rstudio.cloud, so I wouldn't have access to *nix commands, but I'll try the other suggestion you posted.

1 Like

Hi @pjz: I ran this on rstudio.cloud, but I still get the same error. From a previous post, it sounds like there may be an issue with Rcpp, and I wonder whether it's involved here, too, since the package imports and links to Rcpp?

Surely. I think you should update your version of R (my version is R-3.5 and it doesn't work)
Regards

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.