Closed fabeit closed 1 year ago
It means that the summary function needs to accept the values as a first argument and the coverage fractions as a second argument, like the built-in function weighted.mean
. The error is raised because the sum
function does not accept the coverage fractions. Maybe calling with fun = 'sum'
will provide the behavior you are looking for?
I am trying to use the following
myrast=rast(ymin=-90,ymax=90,xmin=-180,xmax=180,nrows=90,ncols=180) myshape=read_sf(myshape.shp) sf [287 × 34] (S3: sf/tbl_df/tbl/data.frame)
result=exact_extract(myrast,myshape,fun=sum)
Error in .local(x, y, ...) : exact_extract was called with a function that does not appear to be of the form
function(values, coverage_fractions, ...)
. If the summary function should accept a single data frame argument, setsummarize_df = TRUE
I am not sure what does this mean. Can you please help?