Package check result: OK Changes to worse in reverse depends: Package: stars Check: examples New result: ERROR Running examples in ‘stars-Ex.R’ failed The error most likely occurred in: > base::assign(".ptime", proc.time(), pos = "CheckExEnv") > ### Name: aggregate.stars > ### Title: spatially or temporally aggregate stars object > ### Aliases: aggregate.stars aggregate > > ### ** Examples > > # aggregate time dimension in format Date > 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] Error in `/.difftime`(diff(range(ud)), mean(ud)) : second argument of / cannot be a "difftime" object Calls: read_stars ... create_dimension -> regular_intervals -> isTRUE -> /.difftime Execution halted Package: stars Check: tests New result: ERROR Running ‘aggregate.R’ [1s/1s] Running ‘align.R’ [1s/1s] Comparing ‘align.Rout’ to ‘align.Rout.save’ ... OK Running ‘area.R’ [1s/1s] Comparing ‘area.Rout’ to ‘area.Rout.save’ ... OK Running ‘crop.R’ [3s/3s] Comparing ‘crop.Rout’ to ‘crop.Rout.save’ ... OK Running ‘curvilinear.R’ [1s/1s] Comparing ‘curvilinear.Rout’ to ‘curvilinear.Rout.save’ ... OK Running ‘datasets.R’ [1s/1s] Comparing ‘datasets.Rout’ to ‘datasets.Rout.save’ ... OK Running ‘dimensions.R’ [1s/1s] Running ‘downsample.R’ [1s/1s] Comparing ‘downsample.Rout’ to ‘downsample.Rout.save’ ... OK Running ‘ee.R’ [1s/1s] Comparing ‘ee.Rout’ to ‘ee.Rout.save’ ... OK Running ‘extract.R’ [1s/1s] Comparing ‘extract.Rout’ to ‘extract.Rout.save’ ... OK Running ‘gridtypes.R’ [1s/1s] Running ‘mdim.R’ [1s/1s] Running ‘nc.R’ [1s/1s] Comparing ‘nc.Rout’ to ‘nc.Rout.save’ ... OK Running ‘plot.R’ [1s/1s] Running ‘predict.R’ [3s/3s] Comparing ‘predict.Rout’ to ‘predict.Rout.save’ ... OK Running ‘proxy.R’ [2s/2s] Comparing ‘proxy.Rout’ to ‘proxy.Rout.save’ ... OK Running ‘raster.R’ [6s/6s] Comparing ‘raster.Rout’ to ‘raster.Rout.save’ ... OK Running ‘rasterize.R’ [2s/2s] Comparing ‘rasterize.Rout’ to ‘rasterize.Rout.save’ ... OK Running ‘rectilinear.R’ [1s/1s] Comparing ‘rectilinear.Rout’ to ‘rectilinear.Rout.save’ ... OK Running ‘redimension.R’ [1s/1s] Running ‘sf.R’ [1s/1s] Running ‘sp.R’ [1s/1s] Comparing ‘sp.Rout’ to ‘sp.Rout.save’ ... OK Running ‘spacetime.R’ [1s/1s] Running ‘spatstat.R’ [2s/2s] Comparing ‘spatstat.Rout’ to ‘spatstat.Rout.save’ ... OK Running ‘stars.R’ [5s/5s] Comparing ‘stars.Rout’ to ‘stars.Rout.save’ ... OK Running ‘subset.R’ [1s/1s] Comparing ‘subset.Rout’ to ‘subset.Rout.save’ ... OK Running ‘testthat.R’ [9s/9s] Running ‘tidy.R’ [1s/1s] Comparing ‘tidy.Rout’ to ‘tidy.Rout.save’ ... OK Running ‘transform.R’ [1s/1s] Comparing ‘transform.Rout’ to ‘transform.Rout.save’ ... OK Running ‘warp.R’ [1s/1s] Comparing ‘warp.Rout’ to ‘warp.Rout.save’ ... OK Running ‘write.R’ [1s/1s] Comparing ‘write.Rout’ to ‘write.Rout.save’ ... OK Running the tests in ‘tests/aggregate.R’ failed. Complete output: > ## IGNORE_RDIFF_BEGIN > library(stars) Loading required package: abind Loading required package: sf Linking to GEOS 3.13.0, GDAL 3.10.1, PROJ 9.5.1; sf_use_s2() is TRUE > ## IGNORE_RDIFF_END > > if (suppressPackageStartupMessages(require(sp, quietly = TRUE)) && require(spacetime, quietly = TRUE)) { + data(air) # this loads several datasets in .GlobalEnv + dim(air) + d = st_dimensions(station = st_set_crs(st_as_sfc(stations), 4326), time = dates) + + blocks = st_make_grid(st_as_sfc("POLYGON ((5.871619 47.26986, 15.03811 47.26986, 15.03811 55.05653, 5.871619 55.05653, 5.871619 47.26986))", crs = 4326), + n = c(3,3)) + + print(aq <- st_as_stars(list(PM10 = air), dimensions = d)) + print(a <- aggregate(aq, blocks, mean, na.rm = TRUE)) + } Error in `/.difftime`(diff(range(ud)), mean(ud)) : second argument of / cannot be a "difftime" object Calls: st_dimensions ... -> regular_intervals -> isTRUE -> /.difftime Execution halted Running the tests in ‘tests/dimensions.R’ failed. Complete output: > # https://github.com/r-spatial/stars/issues/295 > suppressPackageStartupMessages(library(stars)) > raw <- read_stars(system.file("nc/bcsd_obs_1999.nc", package = "stars")) pr, Error in `/.difftime`(diff(range(ud)), mean(ud)) : second argument of / cannot be a "difftime" object Calls: read_stars ... create_dimension -> regular_intervals -> isTRUE -> /.difftime Execution halted Running the tests in ‘tests/gridtypes.R’ failed. Complete output: > suppressPackageStartupMessages(library(stars)) > > # regular, but not spatial: > d = st_dimensions(a = 1:3, b = 1:3, band = c("foo", "bar")) > (st = st_as_stars(array(1:18, c(3,3,2)), dimension = d)) stars object with 3 dimensions and 1 attribute attribute(s): Min. 1st Qu. Median Mean 3rd Qu. Max. X 1 5.25 9.5 9.5 13.75 18 dimension(s): from to offset delta point values a 1 3 1 1 FALSE NULL b 1 3 1 1 FALSE NULL band 1 2 NA NA FALSE foo, bar > as.data.frame(st, add_max=FALSE)[1:4,] a b band X 1 1 1 foo 1 2 2 1 foo 2 3 3 1 foo 3 4 1 2 foo 4 > try(x <- st_bbox(st)) # error Error in st_bbox.dimensions(st_dimensions(obj), ...) : dimensions table does not have x & y, nor an sfc dimension > > # regular, geotransform: > d = st_dimensions(x = 1:3, y = 1:3, band = c("foo", "bar"), .raster = c("x", "y")) > (st = st_as_stars(array(1:18, c(3,3,2)), dimension = d)) stars object with 3 dimensions and 1 attribute attribute(s): Min. 1st Qu. Median Mean 3rd Qu. Max. X 1 5.25 9.5 9.5 13.75 18 dimension(s): from to offset delta point values x/y x 1 3 1 1 FALSE NULL [x] y 1 3 1 1 FALSE NULL [y] band 1 2 NA NA FALSE foo, bar > as.data.frame(st, add_max=FALSE)[1:4,] x y band X 1 1.5 1.5 foo 1 2 2.5 1.5 foo 2 3 3.5 1.5 foo 3 4 1.5 2.5 foo 4 > as.data.frame(st, add_max=TRUE)[1:4,] x y band x_max y_max X 1 1 1 foo 2 2 1 2 2 1 foo 3 2 2 3 3 1 foo 4 2 3 4 1 2 foo 2 3 4 > st_bbox(st) xmin ymin xmax ymax 1 1 4 4 > > # rectilinear with offset given: > xd = c(1, 2, 4) > d = st_dimensions(x = xd, y = 1:3, band = c("foo", "bar"), .raster = c("x", "y")) > (st = st_as_stars(array(1:18, c(3,3,2)), dimension = d)) stars object with 3 dimensions and 1 attribute attribute(s): Min. 1st Qu. Median Mean 3rd Qu. Max. X 1 5.25 9.5 9.5 13.75 18 dimension(s): from to offset delta point values x/y x 1 3 NA NA FALSE [1,2), [2,4), [4,6) [x] y 1 3 1 1 FALSE NULL [y] band 1 2 NA NA FALSE foo, bar > as.data.frame(st, add_max=FALSE)[1:4,] x y band X 1 1.5 1.5 foo 1 2 3.0 1.5 foo 2 3 5.0 1.5 foo 3 4 1.5 2.5 foo 4 > as.data.frame(st, add_max=TRUE)[1:4,] x y band x_max y_max X 1 1 1 foo 2 2 1 2 2 1 foo 4 2 2 3 4 1 foo 6 2 3 4 1 2 foo 2 3 4 > st_bbox(st) xmin ymin xmax ymax 1 1 6 4 > > # rectilinear with midpoints given: > xd = c(1, 2, 4) > d = st_dimensions(x = xd, y = 1:3, band = c("foo", "bar"), .raster = c("x", "y"), cell_midpoints = TRUE) > (st = st_as_stars(array(1:18, c(3,3,2)), dimension = d)) stars object with 3 dimensions and 1 attribute attribute(s): Min. 1st Qu. Median Mean 3rd Qu. Max. X 1 5.25 9.5 9.5 13.75 18 dimension(s): from to offset delta point values x/y x 1 3 NA NA FALSE [0.5,1.5), [1.5,3.0), [3.0,5.0) [x] y 1 3 0.5 1 FALSE NULL [y] band 1 2 NA NA FALSE foo, bar > as.data.frame(st, add_max=FALSE)[1:4,] x y band X 1 1.00 1 foo 1 2 2.25 1 foo 2 3 4.00 1 foo 3 4 1.00 2 foo 4 > as.data.frame(st, add_max=TRUE)[1:4,] x y band x_max y_max X 1 0.5 0.5 foo 1.5 1.5 1 2 1.5 0.5 foo 3.0 1.5 2 3 3.0 0.5 foo 5.0 1.5 3 4 0.5 1.5 foo 1.5 2.5 4 > st_bbox(st) xmin ymin xmax ymax 0.5 0.5 5.0 3.5 > > # rectilinear with midpoints given, point support > xd = c(1, 2, 4) > d = st_dimensions(x = xd, y = 1:3, band = c("foo", "bar"), .raster = c("x", "y"), cell_midpoints = TRUE, point = TRUE) > (st = st_as_stars(array(1:18, c(3,3,2)), dimension = d)) stars object with 3 dimensions and 1 attribute attribute(s): Min. 1st Qu. Median Mean 3rd Qu. Max. X 1 5.25 9.5 9.5 13.75 18 dimension(s): from to offset delta point values x/y x 1 3 NA NA TRUE 1, 2, 4 [x] y 1 3 0.5 1 TRUE NULL [y] band 1 2 NA NA TRUE foo, bar > as.data.frame(st, add_max=FALSE)[1:4,] x y band X 1 1 1 foo 1 2 2 1 foo 2 3 4 1 foo 3 4 1 2 foo 4 > as.data.frame(st, add_max=TRUE)[1:4,] x y band x_max y_max X 1 1 0.5 foo 1 1.5 1 2 2 0.5 foo 2 1.5 2 3 4 0.5 foo 4 1.5 3 4 1 1.5 foo 1 2.5 4 > st_bbox(st) xmin ymin xmax ymax 1.0 0.5 4.0 3.5 > > # rectilinear with start/end given: > #xd = stars:::make_intervals(start = c(1,2,4), end = c(2, 4, 8)) > xd = c(1, 2, 4, 8) # one more than dim of the data array > d = st_dimensions(x = xd, y = 1:3, band = c("foo", "bar"), .raster = c("x", "y")) > (st = st_as_stars(array(1:18, c(3,3,2)), dimension = d)) stars object with 3 dimensions and 1 attribute attribute(s): Min. 1st Qu. Median Mean 3rd Qu. Max. X 1 5.25 9.5 9.5 13.75 18 dimension(s): from to offset delta point values x/y x 1 3 NA NA FALSE [1,2), [2,4), [4,8) [x] y 1 3 1 1 FALSE NULL [y] band 1 2 NA NA FALSE foo, bar > as.data.frame(st, add_max=FALSE)[1:4,] x y band X 1 1.5 1.5 foo 1 2 3.0 1.5 foo 2 3 6.0 1.5 foo 3 4 1.5 2.5 foo 4 > as.data.frame(st, add_max=TRUE)[1:4,] x y band x_max y_max X 1 1 1 foo 2 2 1 2 2 1 foo 4 2 2 3 4 1 foo 8 2 3 4 1 2 foo 2 3 4 > st_bbox(st) xmin ymin xmax ymax 1 1 8 4 > > # with sfc: > sfc = st_sfc(st_point(0:1), st_point(2:1), st_point(4:3)) > d = st_dimensions(x = sfc, y = 1:3, band = c("foo", "bar")) > (st = st_as_stars(array(1:18, c(3,3,2)), dimension = d)) stars object with 3 dimensions and 1 attribute attribute(s): Min. 1st Qu. Median Mean 3rd Qu. Max. X 1 5.25 9.5 9.5 13.75 18 dimension(s): from to offset delta point values x 1 3 NA NA TRUE POINT (0 1),...,POINT (4 3) y 1 3 1 1 FALSE NULL band 1 2 NA NA FALSE foo, bar > as.data.frame(st, add_max=FALSE)[1:4,] x y band X 1 POINT (0 1) 1 foo 1 2 POINT (2 1) 1 foo 2 3 POINT (4 3) 1 foo 3 4 POINT (0 1) 2 foo 4 > st_as_sf(st, long = TRUE)[1:4,] Simple feature collection with 4 features and 3 fields Geometry type: POINT Dimension: XY Bounding box: xmin: 0 ymin: 1 xmax: 4 ymax: 3 CRS: NA y band X x 1 1 foo 1 POINT (0 1) 2 1 foo 2 POINT (2 1) 3 1 foo 3 POINT (4 3) 4 2 foo 4 POINT (0 1) > st_bbox(st) xmin ymin xmax ymax 0 1 4 3 > > # rotated/sheared: > d = st_dimensions(x = 1:3, y = 1:3, band = c("foo", "bar"), .raster = c("x", "y"), affine = c(0.2, -0.2)) > (st = st_as_stars(array(1:18, c(3,3,2)), dimension = d)) stars object with 3 dimensions and 1 attribute attribute(s): Min. 1st Qu. Median Mean 3rd Qu. Max. X 1 5.25 9.5 9.5 13.75 18 dimension(s): from to offset delta point values x/y x 1 3 1 1 FALSE NULL [x] y 1 3 1 1 FALSE NULL [y] band 1 2 NA NA FALSE foo, bar sheared raster with parameters: 0.2 -0.2 > as.data.frame(st, add_max=FALSE)[1:4,] x y X 1 1.6 1.4 1 2 2.6 1.2 2 3 3.6 1.0 3 4 1.8 2.4 4 > try(as.data.frame(st, add_max=TRUE)[1:4,]) # errors Error in st_coordinates.stars(x, add_max = add_max, center = center, ...) : add_max will not work for rotated/shared rasters > st_bbox(st) xmin ymin xmax ymax 1.0 0.4 4.6 4.0 > > # curvilinear: > set.seed(13531) > lon = st_as_stars(matrix(signif(runif(9), 2), 3, 3)) > lat = st_as_stars(matrix(signif(runif(9), 2), 3, 3)) > ll = setNames(c(lon, lat), c("lon", "lat")) > d = st_dimensions(lon = 1:3, lat = 1:3) > a = st_as_stars(list(X = array(1:9, c(3,3))), dimensions = d) > (st = st_as_stars(a, curvilinear = ll)) stars object with 2 dimensions and 1 attribute attribute(s): Min. 1st Qu. Median Mean 3rd Qu. Max. X 1 3 5 5 7 9 dimension(s): from to refsys point values x/y lon 1 3 WGS 84 (CRS84) FALSE [3x3] 0.03,...,0.89 [x] lat 1 3 WGS 84 (CRS84) FALSE [3x3] 0.021,...,0.89 [y] curvilinear grid > as.data.frame(st) lon lat X 1 0.89 0.250 1 2 0.64 0.510 2 3 0.30 0.670 3 4 0.69 0.890 4 5 0.47 0.890 5 6 0.26 0.190 6 7 0.57 0.021 7 8 0.27 0.220 8 9 0.03 0.340 9 > st_bbox(st) xmin ymin xmax ymax 0.030 0.021 0.890 0.890 > > # time regular: > t = as.Date("2019-01-20") + 0:3 > d = st_dimensions(t, sfc) Error in `/.difftime`(diff(range(ud)), mean(ud)) : second argument of / cannot be a "difftime" object Calls: st_dimensions ... -> regular_intervals -> isTRUE -> /.difftime Execution halted Running the tests in ‘tests/mdim.R’ failed. Complete output: > Sys.setenv(TZ="") > suppressPackageStartupMessages(library(stars)) > matrix(1:4,2) [,1] [,2] [1,] 1 3 [2,] 2 4 > m = matrix(1:4,2) > s = st_as_stars(m) > > s = st_set_dimensions(s, st_dimensions(s), xy = NULL) > sfc = st_sfc(st_point(0:1), st_point(3:2)) > s = st_set_dimensions(s, 1, sfc) |> st_set_crs(4326) > tm = as.POSIXct("2023-03-04 12:35") + c(0, 3600) > s = st_set_dimensions(s, 2, tm) Error in `/.difftime`(diff(range(ud)), mean(ud)) : second argument of / cannot be a "difftime" object Calls: st_set_dimensions ... create_dimension -> regular_intervals -> isTRUE -> /.difftime Execution halted Running the tests in ‘tests/plot.R’ failed. Complete output: > suppressPackageStartupMessages(library(stars)) > if (suppressPackageStartupMessages(require(sp, quietly = TRUE)) && require(spacetime, quietly = TRUE)) { + data(air) # this loads several datasets in .GlobalEnv + dim(air) + d = st_dimensions(station = st_as_sfc(stations), time = dates) + aq = st_as_stars(list(PM10 = air), dimensions = d) + image(aperm(log(aq), 2:1), main = "NA pattern (white) in PM10 station time series") + st_geometry(aq) + } Error in `/.difftime`(diff(range(ud)), mean(ud)) : second argument of / cannot be a "difftime" object Calls: st_dimensions ... -> regular_intervals -> isTRUE -> /.difftime Execution halted Running the tests in ‘tests/redimension.R’ failed. Complete output: > suppressPackageStartupMessages(library(stars)) > tif = system.file("tif/L7_ETMs.tif", package = "stars") > r = read_stars(list(a = c(tif,tif), b = c(tif, tif)), proxy = TRUE) > (xx = st_redimension(r, along = list(foo = 1:4))) stars_proxy object with 1 attribute in 4 file(s): $a.L7_ETMs.tif.a.L7_ETMs.tif.b.L7_ETMs.tif.b.L7_ETMs.tif [1] "[...]/L7_ETMs.tif" "[...]/L7_ETMs.tif" "[...]/L7_ETMs.tif" [4] "[...]/L7_ETMs.tif" dimension(s): from to offset delta refsys point x/y x 1 349 288776 28.5 SIRGAS 2000 / UTM zone 25S FALSE [x] y 1 352 9120761 -28.5 SIRGAS 2000 / UTM zone 25S FALSE [y] band 1 6 NA NA NA NA foo 1 4 1 1 NA NA > (rr = c(xx, xx)) stars_proxy object with 2 attributes in 8 file(s): $a.L7_ETMs.tif.a.L7_ETMs.tif.b.L7_ETMs.tif.b.L7_ETMs.tif [1] "[...]/L7_ETMs.tif" "[...]/L7_ETMs.tif" "[...]/L7_ETMs.tif" [4] "[...]/L7_ETMs.tif" $a.L7_ETMs.tif.a.L7_ETMs.tif.b.L7_ETMs.tif.b.L7_ETMs.tif [1] "[...]/L7_ETMs.tif" "[...]/L7_ETMs.tif" "[...]/L7_ETMs.tif" [4] "[...]/L7_ETMs.tif" dimension(s): from to offset delta refsys point x/y x 1 349 288776 28.5 SIRGAS 2000 / UTM zone 25S FALSE [x] y 1 352 9120761 -28.5 SIRGAS 2000 / UTM zone 25S FALSE [y] band 1 6 NA NA NA NA foo 1 4 1 1 NA NA > # st_as_stars(rr) > (rrr = st_redimension(rr, along = list(bar = as.Date(c("2001-01-01", "2002-01-01"))))) Error in `/.difftime`(diff(range(ud)), mean(ud)) : second argument of / cannot be a "difftime" object Calls: st_redimension ... create_dimension -> regular_intervals -> isTRUE -> /.difftime Execution halted Running the tests in ‘tests/sf.R’ failed. Complete output: > suppressPackageStartupMessages(library(stars)) > library(sf) > #jp2 = system.file("jp2/B01.jp2", package = "stars") > #(x = read_stars(jp2, options = c("OVERVIEW_LEVEL=3"))) > tif = system.file("tif/L7_ETMs.tif", package = "stars") > #(x = read_stars(tif, options = c("OVERVIEW_LEVEL=3"))) # FIXME: breaks on windows > (x = read_stars(tif)[,1:20,1:20]) stars object with 3 dimensions and 1 attribute attribute(s): Min. 1st Qu. Median Mean 3rd Qu. Max. L7_ETMs.tif 17 44 58 58.19667 70 130 dimension(s): from to offset delta refsys point x/y x 1 20 288776 28.5 SIRGAS 2000 / UTM zone 25S FALSE [x] y 1 20 9120761 -28.5 SIRGAS 2000 / UTM zone 25S FALSE [y] band 1 6 NA NA NA NA > # names(x) = "L7_ETM" > > # library(abind) > # x = adrop(x) > image(x) > (sfc = st_as_sfc(x, as_points = FALSE)) Geometry set for 400 features Geometry type: POLYGON Dimension: XY Bounding box: xmin: 288776.3 ymin: 9120191 xmax: 289346.3 ymax: 9120761 Projected CRS: SIRGAS 2000 / UTM zone 25S First 5 geometries: POLYGON ((288776.3 9120761, 288804.8 9120761, 2... POLYGON ((288804.8 9120761, 288833.3 9120761, 2... POLYGON ((288833.3 9120761, 288861.8 9120761, 2... POLYGON ((288861.8 9120761, 288890.3 9120761, 2... POLYGON ((288890.3 9120761, 288918.8 9120761, 2... > plot(sfc, add =TRUE) > (sfc = st_as_sfc(x, as_points = TRUE)) Geometry set for 400 features Geometry type: POINT Dimension: XY Bounding box: xmin: 288790.5 ymin: 9120205 xmax: 289332 ymax: 9120747 Projected CRS: SIRGAS 2000 / UTM zone 25S First 5 geometries: POINT (288790.5 9120747) POINT (288819 9120747) POINT (288847.5 9120747) POINT (288876 9120747) POINT (288904.5 9120747) > plot(sfc, add = TRUE) > > sf = st_as_sf(x, as_points = FALSE) > plot(sf, border = NA) > sf = st_as_sf(x[,,,1], as_points = FALSE, merge = TRUE) > plot(sf, border = NA) > > sfc1 <- st_as_sfc(x, as_points = TRUE, use_cpp = TRUE, na.rm = FALSE) > sfc2 <- st_as_sfc(x, as_points = TRUE, use_cpp = FALSE) > identical(sfc1, sfc2) [1] TRUE > > sfc1 <- st_as_sfc(x, as_points = FALSE, use_cpp = TRUE, na.rm = FALSE) > sfc2 <- st_as_sfc(x, as_points = FALSE, use_cpp = FALSE) > identical(sfc1, sfc2) [1] TRUE > > # sf -> stars -> sf > x = st_sfc(st_point(0:1), st_point(1:2), st_point(2:3)) > m = matrix(1:9,3) > colnames(m) = c("a", "b", "c") > foo = st_sf(m, geom = x) > x = st_as_stars(foo) > c(x) stars object with 1 dimensions and 3 attributes attribute(s): Min. 1st Qu. Median Mean 3rd Qu. Max. a 1 1.5 2 2 2.5 3 b 4 4.5 5 5 5.5 6 c 7 7.5 8 8 8.5 9 dimension(s): from to point values geom 1 3 TRUE POINT (0 1),...,POINT (2 3) > st_redimension(x) stars object with 2 dimensions and 1 attribute attribute(s): Min. 1st Qu. Median Mean 3rd Qu. Max. a.b.c 1 3 5 5 7 9 dimension(s): from to point values geom 1 3 TRUE POINT (0 1),...,POINT (2 3) new_dim 1 3 NA a, b, c > c(x, x) stars object with 1 dimensions and 6 attributes attribute(s): Min. 1st Qu. Median Mean 3rd Qu. Max. a 1 1.5 2 2 2.5 3 b 4 4.5 5 5 5.5 6 c 7 7.5 8 8 8.5 9 a.1 1 1.5 2 2 2.5 3 b.1 4 4.5 5 5 5.5 6 c.1 7 7.5 8 8 8.5 9 dimension(s): from to point values geom 1 3 TRUE POINT (0 1),...,POINT (2 3) > (y = st_redimension(x, along = list(time = as.Date("2017-11-27") + 0:2))) Error in `/.difftime`(diff(range(ud)), mean(ud)) : second argument of / cannot be a "difftime" object Calls: st_redimension ... create_dimension -> regular_intervals -> isTRUE -> /.difftime Execution halted Running the tests in ‘tests/spacetime.R’ failed. Complete output: > suppressPackageStartupMessages(library(stars)) > if (suppressPackageStartupMessages(require(sp, quietly = TRUE)) && require(spacetime, quietly = TRUE)) { + set.seed(1331) + Sys.setenv(TZ="UTC") + example(STFDF) + + x = st_as_stars(stfdf) + xx = as(x, "STFDF") + + # as.xts.stars: + library(xts) + xts = as.xts(x) + st_as_stars(xts) + st_as_stars(xts, dimensions = st_dimensions(x)) + + library(sp) + pts = SpatialPoints(rbind(c(0,0), c(0,1), c(1,0), c(1,1))) + gridded(pts) = TRUE + + tm = xts(1:10, as.Date("2010-01-01")+0:9) + stfdf = STFDF(pts, tm, data.frame(foo = seq_len(length(pts) * length(tm)))) + x = st_as_stars(stfdf) + xx = as(x, "STFDF") + + x = st_as_stars(as(stfdf, "STSDF")) + } STFDF> sp = cbind(x = c(0,0,1), y = c(0,1,1)) STFDF> row.names(sp) = paste("point", 1:nrow(sp), sep="") STFDF> library(sp) STFDF> sp = SpatialPoints(sp) STFDF> time = as.POSIXct("2010-08-05")+3600*(10:13) STFDF> m = c(10,20,30) # means for each of the 3 point locations STFDF> mydata = rnorm(length(sp)*length(time),mean=rep(m, 4)) STFDF> IDs = paste("ID",1:length(mydata)) STFDF> mydata = data.frame(values = signif(mydata,3), ID=IDs) STFDF> stfdf = STFDF(sp, time, mydata) STFDF> stfdf An object of class "STFDF" Slot "data": values ID 1 9.38 ID 1 2 21.10 ID 2 3 29.80 ID 3 4 11.50 ID 4 5 19.80 ID 5 6 31.20 ID 6 7 10.40 ID 7 8 20.50 ID 8 9 29.80 ID 9 10 10.30 ID 10 11 21.40 ID 11 12 29.40 ID 12 Slot "sp": SpatialPoints: x y point1 0 0 point2 0 1 point3 1 1 Coordinate Reference System (CRS) arguments: NA Slot "time": timeIndex 2010-08-05 10:00:00 1 2010-08-05 11:00:00 2 2010-08-05 12:00:00 3 2010-08-05 13:00:00 4 Slot "endTime": [1] "2010-08-05 11:00:00 UTC" "2010-08-05 12:00:00 UTC" [3] "2010-08-05 13:00:00 UTC" "2010-08-05 14:00:00 UTC" STFDF> stfdf[1:2,] An object of class "STFDF" Slot "data": values ID 1 9.38 ID 1 2 21.10 ID 2 3 11.50 ID 4 4 19.80 ID 5 5 10.40 ID 7 6 20.50 ID 8 7 10.30 ID 10 8 21.40 ID 11 Slot "sp": SpatialPoints: x y point1 0 0 point2 0 1 Coordinate Reference System (CRS) arguments: NA Slot "time": timeIndex 2010-08-05 10:00:00 1 2010-08-05 11:00:00 2 2010-08-05 12:00:00 3 2010-08-05 13:00:00 4 Slot "endTime": [1] "2010-08-05 11:00:00 UTC" "2010-08-05 12:00:00 UTC" [3] "2010-08-05 13:00:00 UTC" "2010-08-05 14:00:00 UTC" STFDF> stfdf[,1:2] An object of class "STFDF" Slot "data": values ID 1 9.38 ID 1 2 21.10 ID 2 3 29.80 ID 3 4 11.50 ID 4 5 19.80 ID 5 6 31.20 ID 6 Slot "sp": SpatialPoints: x y point1 0 0 point2 0 1 point3 1 1 Coordinate Reference System (CRS) arguments: NA Slot "time": timeIndex 2010-08-05 10:00:00 1 2010-08-05 11:00:00 2 Slot "endTime": [1] "2010-08-05 11:00:00 UTC" "2010-08-05 12:00:00 UTC" STFDF> stfdf[,,2] An object of class "STFDF" Slot "data": ID 1 ID 1 2 ID 2 3 ID 3 4 ID 4 5 ID 5 6 ID 6 7 ID 7 8 ID 8 9 ID 9 10 ID 10 11 ID 11 12 ID 12 Slot "sp": SpatialPoints: x y point1 0 0 point2 0 1 point3 1 1 Coordinate Reference System (CRS) arguments: NA Slot "time": timeIndex 2010-08-05 10:00:00 1 2010-08-05 11:00:00 2 2010-08-05 12:00:00 3 2010-08-05 13:00:00 4 Slot "endTime": [1] "2010-08-05 11:00:00 UTC" "2010-08-05 12:00:00 UTC" [3] "2010-08-05 13:00:00 UTC" "2010-08-05 14:00:00 UTC" STFDF> stfdf[,,"values"] An object of class "STFDF" Slot "data": values 1 9.38 2 21.10 3 29.80 4 11.50 5 19.80 6 31.20 7 10.40 8 20.50 9 29.80 10 10.30 11 21.40 12 29.40 Slot "sp": SpatialPoints: x y point1 0 0 point2 0 1 point3 1 1 Coordinate Reference System (CRS) arguments: NA Slot "time": timeIndex 2010-08-05 10:00:00 1 2010-08-05 11:00:00 2 2010-08-05 12:00:00 3 2010-08-05 13:00:00 4 Slot "endTime": [1] "2010-08-05 11:00:00 UTC" "2010-08-05 12:00:00 UTC" [3] "2010-08-05 13:00:00 UTC" "2010-08-05 14:00:00 UTC" STFDF> stfdf[1,] values ID timeIndex 2010-08-05 10:00:00 9.38 ID 1 1 2010-08-05 11:00:00 11.50 ID 4 2 2010-08-05 12:00:00 10.40 ID 7 3 2010-08-05 13:00:00 10.30 ID 10 4 STFDF> stfdf[,2] coordinates values ID 1 (0, 0) 11.5 ID 4 2 (0, 1) 19.8 ID 5 3 (1, 1) 31.2 ID 6 STFDF> as(stfdf[,,1], "xts") point1 point2 point3 2010-08-05 10:00:00 9.38 21.1 29.8 2010-08-05 11:00:00 11.50 19.8 31.2 2010-08-05 12:00:00 10.40 20.5 29.8 2010-08-05 13:00:00 10.30 21.4 29.4 STFDF> as(stfdf[,,2], "xts") point1 point2 point3 2010-08-05 10:00:00 ID 1 ID 2 ID 3 2010-08-05 11:00:00 ID 4 ID 5 ID 6 2010-08-05 12:00:00 ID 7 ID 8 ID 9 2010-08-05 13:00:00 ID 10 ID 11 ID 12 STFDF> # examples for [[, [[<-, $ and $<- STFDF> stfdf[[1]] [1] 9.38 21.10 29.80 11.50 19.80 31.20 10.40 20.50 29.80 10.30 21.40 29.40 STFDF> stfdf[["values"]] [1] 9.38 21.10 29.80 11.50 19.80 31.20 10.40 20.50 29.80 10.30 21.40 29.40 STFDF> stfdf[["newVal"]] <- rnorm(12) STFDF> stfdf$ID [1] "ID 1" "ID 2" "ID 3" "ID 4" "ID 5" "ID 6" "ID 7" "ID 8" "ID 9" [10] "ID 10" "ID 11" "ID 12" STFDF> stfdf$ID = paste("OldIDs", 1:12, sep="") STFDF> stfdf$NewID = paste("NewIDs", 12:1, sep="") STFDF> stfdf An object of class "STFDF" Slot "data": values ID newVal NewID 1 9.38 OldIDs1 -0.3125824 NewIDs12 2 21.10 OldIDs2 -1.0536246 NewIDs11 3 29.80 OldIDs3 -0.7188880 NewIDs10 4 11.50 OldIDs4 -1.0525404 NewIDs9 5 19.80 OldIDs5 -0.8441413 NewIDs8 6 31.20 OldIDs6 1.1420848 NewIDs7 7 10.40 OldIDs7 1.9479070 NewIDs6 8 20.50 OldIDs8 -0.4512836 NewIDs5 9 29.80 OldIDs9 0.6695716 NewIDs4 10 10.30 OldIDs10 0.1269003 NewIDs3 11 21.40 OldIDs11 -0.7273297 NewIDs2 12 29.40 OldIDs12 -0.8151803 NewIDs1 Slot "sp": SpatialPoints: x y point1 0 0 point2 0 1 point3 1 1 Coordinate Reference System (CRS) arguments: NA Slot "time": timeIndex 2010-08-05 10:00:00 1 2010-08-05 11:00:00 2 2010-08-05 12:00:00 3 2010-08-05 13:00:00 4 Slot "endTime": [1] "2010-08-05 11:00:00 UTC" "2010-08-05 12:00:00 UTC" [3] "2010-08-05 13:00:00 UTC" "2010-08-05 14:00:00 UTC" STFDF> x = stfdf[stfdf[1:2,],] STFDF> all.equal(x, stfdf[1:2,]) [1] TRUE STFDF> all.equal(stfdf, stfdf[stfdf,]) # converts character to factor... [1] TRUE Error in `/.difftime`(diff(range(ud)), mean(ud)) : second argument of / cannot be a "difftime" object Calls: st_as_stars ... create_dimension -> regular_intervals -> isTRUE -> /.difftime Execution halted Running the tests in ‘tests/testthat.R’ failed. Complete output: > ## load dependencies > library(testthat) > suppressPackageStartupMessages(library(stars)) > > ## test package > test_check("stars") [ FAIL 2 | WARN 1 | SKIP 4 | PASS 58 ] ══ Skipped tests (4) ═══════════════════════════════════════════════════════════ • On CRAN (4): 'test-OpenStreetMap.R:2:3', 'test-ncdf.R:1:1', 'test-ncproxy.R:1:1', 'test-rectilinear.R:89:3' ══ Failed tests ════════════════════════════════════════════════════════════════ ── Error ('test-cubble.R:30:3'): cubble ──────────────────────────────────────── Error in ``/.difftime`(diff(range(ud)), mean(ud))`: second argument of / cannot be a "difftime" object Backtrace: ▆ 1. ├─stars::st_as_stars(a.cb) at test-cubble.R:30:3 2. └─stars:::st_as_stars.cubble_df(a.cb) 3. ├─stars:::create_dimensions(...) 4. └─stars:::create_dimension(values = times) 5. └─stars:::regular_intervals(values) 6. ├─base::isTRUE(as.numeric(abs(diff(range(ud))/mean(ud))) < epsilon) 7. └─base::`/.difftime`(diff(range(ud)), mean(ud)) ── Error ('test-stars.R:14:3'): basic st_as_stars ────────────────────────────── Error in ``/.difftime`(diff(range(ud)), mean(ud))`: second argument of / cannot be a "difftime" object Backtrace: ▆ 1. ├─stars::st_as_stars(test_list) at test-stars.R:14:3 2. └─stars:::st_as_stars.ncdfgeom(test_list) 3. └─stars:::create_dimension(...) 4. └─stars:::regular_intervals(values) 5. ├─base::isTRUE(as.numeric(abs(diff(range(ud))/mean(ud))) < epsilon) 6. └─base::`/.difftime`(diff(range(ud)), mean(ud)) [ FAIL 2 | WARN 1 | SKIP 4 | PASS 58 ] Error: Test failures Execution halted