I am currently reading the new (and free!) book by Edzer Pebesma and Roger Bivand (you can find it here).
In chapter four they describe how one can aggregate all the measurement stations within one state. I follow there code but get an error. How so?
library(sf)
library(spacetime)
library(rgeos)
library(stars)
# dataset from spacetime package
data(air)
d = st_dimensions(station = st_as_sfc(stations), time = dates)
aq = st_as_stars(list(PM10 = air), dimensions = d)
a = aggregate(aq, st_as_sf(DE_NUTS1), mean, na.rm = TRUE)
The last line returns the error:
Error in aggregate.data.frame(as.data.frame(x), ...) :
Arguments must have same length
Best Answer
You can check if
aggregate
method is supported bymethods()
.Ta-da!
stars 0.3-0
is on CRAN today (25/FEB/2019).You can see
aggreagte
is listed. Yay!By the way, if you add
tidyverse
, the list expands like: