aggregating r-stars with vector-valued output

36 views Asked by At

Is there a clean way of aggregating a stars object with a function producing more than one output (for example range instead of max)?

> tif = system.file("tif/L7_ETMs.tif", package = "stars")
> t1 = as.Date("2018-07-31")
> x = read_stars(c(tif, tif, tif, tif), along = list(time = c(t1, t1+1, t1+2, t1+3)))[,1:30,1:30]
> x_agg_time2 = aggregate(x, by = '2 days', FUN = max) 
> x_agg_time3 = aggregate(x, by = '2 days', FUN = range) 
Error in attributes(.Data) <- c(attributes(.Data), attrib) : 
  dims [product 10800] do not match the length of object [21600]
1

There are 1 answers

0
Edzer Pebesma On

Thanks for the clear example; this should now work if you install stars from github.