Robert Hijmans

Results 183 comments of Robert Hijmans

I would also love to have gridOptions.

`patches` detects patches (connect cells that have *any* value) surrounded by `NA` (or zero). You assume that it detects patches of cells surrounded by cells with *any other* value. That...

If a SpatRaster has colors, either via a "color table" or because it has RGB layers, but it does not have levels (it is not categorical), then it is a...

Two suggestions ``` addRasterLegend 0) && (layer

"?terra:coltab" should be "?terra::coltab"

Yes, that situation is not uncommon. The below is one way to handle that (with changed test data) ``` addRasterLegend 0) && (layer

@jcheng5 your approach is more elegant. In my two commits I suggest using "unique(x)" instead of "values(x)" to avoid memory issues. And using `RGB(x)` instead of `x@ptr$rgb` as the latter...

It would be great to have gridOptions

`raster::rasterize` also has that option (but is especially slow). With `terra::rasterize` you can do "sum=TRUE", but I will add min, max and mean (and use the "fun=" argument for that)....

@Farewe: you can use `fun="sum"` or that. I have now also added `fun="count"` to make that intent clearer. ``` library(terra) v