-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error: Expecting a single string value: [type=closure; extent=1] #13
Comments
What the error is saying is that ?fasterize
#character. The name of a function by which to combine overlapping polygons.
# Currently takes "sum", "first", "last", "min", "max", "count", or "any". You cannot apply a mean at all currently, but there's a workaround for using raster for this described in the help. Something like (untested ...) x <- fasterize(riv129mprdsf, canus1kgrd, by = "riv129_20k", background=0)
act <- calc(x, mean) Beware that if you have a lot of distinct values in that field you'll get a huge-number layered raster, which might be a pain so first try this, if it's more than "a few" you'll get a very large raster given your x/y dimensions here, so iterating over individual features and accumulating a sum with raster addition might be better than a big-calc in one go. length(unique(riv129mprdsf$riv129_20k)) (Calling a function a closure shows a fun part of R's history as descendant from Lisp, and lexical scoping - it's explained here: http://adv-r.had.co.nz/Functional-programming.html#closures You also get a fun error like this from |
OK. Thanks much!
Prasad
…On Fri, Mar 23, 2018 at 10:01 AM, Noam Ross ***@***.***> wrote:
I'm closing this as it is expected behavior, but opened #18
<#18>, #19
<#19>, and #20
<#20> in response.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#13 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AjQIhyDO9VRoUOrJQ8AnHPUpJ44ZpElfks5thQApgaJpZM4SjGdq>
.
|
Hello: Wanted to report this error. Hope the foll. is self-explanatory. Works with rasterize() but not in fasterize().
The text was updated successfully, but these errors were encountered: