I am trying to run the example code from the exactextractr package in R
library(raster)
library(sf)
library(exactextractr)
brazil <- st_as_sf(getData('GADM', country='BRA', level=2))
prec <- getData('worldclim', var='prec', res=10)
brazil$mean_dec_prec <- exact_extract(prec[[12]], brazil, 'mean')
brazil <- cbind(brazil, exact_extract(prec, brazil, c('min', 'max')))
When I get to the third line I keep getting the following error
in CPP_stats(x, weights, wkb, default_value, default_weight, coverage_area, :
Cannot convert object to a function: [type=NULL; target=CLOSXP, SPECIALSXP, or BUILTINSXP].
I've searched around but I can't find anyone else having this error, I've had other people run the code, we are using the same package versions and it works fine for them.
Does anyone have any ideas on the problem or how to fix it?
Thanks, Dave