Last updated on 2025-08-19 01:48:55 CEST.
Package | ERROR | OK |
---|---|---|
ir | 13 | |
sftime | 5 | 8 |
Current CRAN status: OK: 13
Current CRAN status: ERROR: 5, OK: 8
Version: 0.3.0
Check: re-building of vignette outputs
Result: ERROR
Error(s) in re-building vignettes:
...
--- re-building ‘sftime.Rmd’ using rmarkdown
Quitting from sftime.Rmd:185-195 [unnamed-chunk-6]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<error/rlang_error>
Error in `st_as_sftime.cubble_df()`:
! You need the `cubble` package (>= 0.3.0) to use this function. Install that first.
---
Backtrace:
▆
1. ├─sftime::st_as_sftime(climate_aus[1:4, ])
2. └─sftime:::st_as_sftime.cubble_df(climate_aus[1:4, ])
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Error: processing vignette 'sftime.Rmd' failed with diagnostics:
You need the `cubble` package (>= 0.3.0) to use this function. Install that first.
--- failed re-building ‘sftime.Rmd’
SUMMARY: processing the following file failed:
‘sftime.Rmd’
Error: Vignette re-building failed.
Execution halted
Flavor: r-devel-linux-x86_64-debian-clang
Version: 0.3.0
Check: examples
Result: ERROR
Running examples in ‘sftime-Ex.R’ failed
The error most likely occurred in:
> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: st_as_sftime
> ### Title: Convert a foreign object to an 'sftime' object
> ### Aliases: st_as_sftime st_as_sftime.ST st_as_sftime.Track
> ### st_as_sftime.Tracks st_as_sftime.TracksCollection st_as_sftime.sftime
> ### st_as_sftime.sf st_as_sftime.stars st_as_sftime.data.frame
> ### st_as_sftime.ppp st_as_sftime.psp st_as_sftime.lpp
> ### st_as_sftime.sftrack st_as_sftime.sftraj st_as_sftime.cubble_df
>
> ### ** Examples
>
> # modified from spacetime:
> library(sp)
> library(spacetime)
>
> sp <- cbind(x = c(0,0,1), y = c(0,1,1))
> row.names(sp) <- paste("point", 1:nrow(sp), sep="")
> sp <- SpatialPoints(sp)
> time <- as.POSIXct("2010-08-05") + 3600 * (10:12)
> x <- STI(sp, time)
>
> st_as_sftime(x)
Spatiotemporal feature collection with 3 features and 0 fields
Geometry type: POINT
Dimension: XY
Bounding box: xmin: 0 ymin: 0 xmax: 1 ymax: 1
CRS: NA
Time column with classes: 'POSIXct', 'POSIXt'.
Ranging from 2010-08-05 10:00:00 to 2010-08-05 12:00:00.
st_as_sfc.x.sp. time
1 POINT (0 0) 2010-08-05 10:00:00
2 POINT (0 1) 2010-08-05 11:00:00
3 POINT (1 1) 2010-08-05 12:00:00
>
> # convert a Track object from package trajectories to an sftime object
> library(trajectories)
> x1_Track <- trajectories::rTrack(n = 100)
> x1_Track@data$speed <- sort(rnorm(length(x1_Track)))
> x1_sftime <- st_as_sftime(x1_Track)
>
> # convert a Tracks object from package trajectories to an sftime object
> x2_Tracks <- trajectories::rTracks(m = 6)
> x2_sftime <- st_as_sftime(x2_Tracks)
>
> # convert a TracksCollection object from package trajectories to an sftime object
> x3_TracksCollection <- trajectories::rTracksCollection(p = 2, m = 3, n = 50)
> x3_sftime <- st_as_sftime(x3_TracksCollection)
>
> # convert an sftime object to an sftime object
> st_as_sftime(x3_sftime)
Spatiotemporal feature collection with 300 features and 3 fields
Geometry type: POINT
Dimension: XY
Bounding box: xmin: -28.35517 ymin: -24.66491 xmax: 38.77599 ymax: 52.90631
CRS: NA
Time column with classes: 'POSIXct', 'POSIXt'.
Ranging from 1970-01-01 to 1970-01-01 04:49:00.
First 10 features:
ones tracks_name track_name st_as_sfc.x.sp.
1 1 Tracks1 Track1 POINT (-1.539007 1.932557)
2 1 Tracks1 Track1 POINT (-0.2003776 -0.1679942)
3 1 Tracks1 Track1 POINT (-2.752113 3.166629)
4 1 Tracks1 Track1 POINT (-0.2337229 -0.3806908)
5 1 Tracks1 Track1 POINT (-3.585336 3.267737)
6 1 Tracks1 Track1 POINT (-0.2504837 0.3498938)
7 1 Tracks1 Track1 POINT (-2.653028 1.426368)
8 1 Tracks1 Track1 POINT (0.6410695 -0.5117434)
9 1 Tracks1 Track1 POINT (-2.018482 1.572974)
10 1 Tracks1 Track1 POINT (1.737529 -1.27253)
time
1 1970-01-01 00:00:00
2 1970-01-01 00:00:00
3 1970-01-01 00:01:00
4 1970-01-01 00:01:00
5 1970-01-01 00:02:00
6 1970-01-01 00:02:00
7 1970-01-01 00:03:00
8 1970-01-01 00:03:00
9 1970-01-01 00:04:00
10 1970-01-01 00:04:00
>
> # convert an sf object to an sftime object
> g <- st_sfc(st_point(c(1, 2)), st_point(c(1, 3)), st_point(c(2, 3)),
+ st_point(c(2, 1)), st_point(c(3, 1)))
> x4_sf <- st_sf(a = 1:5, g, time = Sys.time() + 1:5)
> x4_sftime <- st_as_sftime(x4_sf)
>
> # convert a Tracks object from package trajectories to an sftime object
> x5_stars <- stars::read_stars(system.file("nc/bcsd_obs_1999.nc", package = "stars"))
pr, tas,
> x5_sftime <- st_as_sftime(x5_stars, time_column_name = "time")
>
> # this requires some thought to not accidentally drop time dimensions. For
> # example, setting `merge = TRUE` will drop the time dimension and thus throw
> # an error:
> ## Not run:
> ##D x5_sftime <- st_as_sftime(x5_stars, merge = TRUE, time_column_name = "time")
> ## End(Not run)
>
> # convert a data frame to an sftime object
> x5_df <-
+ data.frame(a = 1:5, g, time = Sys.time() + 1:5, stringsAsFactors = FALSE)
> x5_sftime <- st_as_sftime(x5_df)
>
> # convert a ppp object to an sftime object (modified from the sf package)
> if (require(spatstat.geom)) {
+ st_as_sftime(gorillas, time_column_name = "date")
+ }
Loading required package: spatstat.geom
Loading required package: spatstat.data
Loading required package: spatstat.univar
spatstat.univar 3.1-4
spatstat.geom 3.5-0
Spatiotemporal feature collection with 648 features and 3 fields
Geometry type: GEOMETRY
Dimension: XY
Bounding box: xmin: 580457.9 ymin: 674172.8 xmax: 585934 ymax: 678739.2
CRS: NA
Time column with class: 'Date'.
Ranging from 2006-01-06 to 2009-05-31.
First 10 features:
group season label geom date
NA <NA> <NA> window POLYGON ((584712 674237.1, ... <NA>
1 major dry point POINT (582518.4 676886.2) 2006-01-06
2 major dry point POINT (581823 677422.7) 2006-01-10
3 major dry point POINT (582131 676937.9) 2006-01-15
4 major dry point POINT (582111.9 677420) 2006-01-24
5 minor dry point POINT (582585.1 677509.7) 2006-01-27
6 major dry point POINT (582302.3 677521.6) 2006-01-28
7 major dry point POINT (583167.2 676730.5) 2006-02-01
8 major dry point POINT (583584.5 677207.1) 2006-02-03
9 major dry point POINT (583117.8 676850.3) 2006-02-13
>
> # convert a psp object to an sftime object (modified from the spatstat.geom
> # package)
> if (require(spatstat.geom)) {
+ # modified from spatstat.geom:
+ x_psp <-
+ psp(
+ runif(10), runif(10), runif(10), runif(10), window=owin(),
+ marks = data.frame(time = Sys.time() + 1:10)
+ )
+ st_as_sftime(x_psp, time_column_name = "time")
+ }
Spatiotemporal feature collection with 11 features and 1 field
Geometry type: GEOMETRY
Dimension: XY
Bounding box: xmin: 0 ymin: 0 xmax: 1 ymax: 1
CRS: NA
Time column with classes: 'POSIXct', 'POSIXt'.
Ranging from 2025-08-18 18:07:38.761927 to 2025-08-18 18:07:47.761927.
First 10 features:
label geom time
NA window POLYGON ((0 0, 1 0, 1 1, 0 ... <NA>
1 segment LINESTRING (0.6259525 0.976... 2025-08-18 18:07:38
2 segment LINESTRING (0.1771867 0.182... 2025-08-18 18:07:39
3 segment LINESTRING (0.05966493 0.68... 2025-08-18 18:07:40
4 segment LINESTRING (0.9006846 0.153... 2025-08-18 18:07:41
5 segment LINESTRING (0.7344762 0.707... 2025-08-18 18:07:42
6 segment LINESTRING (0.6586887 0.150... 2025-08-18 18:07:43
7 segment LINESTRING (0.9757892 0.408... 2025-08-18 18:07:44
8 segment LINESTRING (0.1329504 0.383... 2025-08-18 18:07:45
9 segment LINESTRING (0.6192392 0.019... 2025-08-18 18:07:46
>
> # convert an lpp object to an sftime object (modified from the
> # spatstat.linnet package)
> if (require(spatstat.geom) && require(spatstat.linnet)) {
+ # modified from spatstat.linnet:
+
+ # letter 'A'
+ v <- spatstat.geom::ppp(x=(-2):2, y=3*c(0,1,2,1,0), c(-3,3), c(-1,7))
+ edg <- cbind(1:4, 2:5)
+ edg <- rbind(edg, c(2,4))
+ letterA <- spatstat.linnet::linnet(v, edges=edg)
+
+ # points on letter A
+ xx <-
+ spatstat.geom::ppp(
+ x=c(-1.5,0,0.5,1.5), y=c(1.5,3,4.5,1.5),
+ marks = data.frame(time = Sys.time() + 1:4, a = 1:4),
+ window = spatstat.geom::owin(
+ xrange = range(c(-1.5,0,0.5,1.5)),
+ yrange = range(c(1.5,3,4.5,1.5)))
+ )
+ x_lpp <- spatstat.linnet::lpp(xx, letterA)
+
+ # convert to sftime
+ st_as_sftime(x_lpp, time_column_name = "time")
+ }
Loading required package: spatstat.linnet
Loading required package: spatstat.random
spatstat.random 3.4-1
Loading required package: spatstat.explore
Loading required package: nlme
spatstat.explore 3.5-2
Loading required package: spatstat.model
Loading required package: rpart
spatstat.model 3.4-0
spatstat.linnet 3.3-1
Spatiotemporal feature collection with 10 features and 4 fields
Geometry type: GEOMETRY
Dimension: XY
Bounding box: xmin: -3 ymin: -1 xmax: 3 ymax: 7
CRS: NA
Time column with classes: 'POSIXct', 'POSIXt'.
Ranging from 2025-08-18 18:07:39.177467 to 2025-08-18 18:07:42.177467.
label seg tp a geom time
1 window NA NA NA POLYGON ((-3 -1, 3 -1, 3 7,... <NA>
2 segment NA NA NA LINESTRING (-2 0, -1 3) <NA>
3 segment NA NA NA LINESTRING (-1 3, 0 6) <NA>
4 segment NA NA NA LINESTRING (0 6, 1 3) <NA>
5 segment NA NA NA LINESTRING (1 3, 2 0) <NA>
6 segment NA NA NA LINESTRING (-1 3, 1 3) <NA>
7 point 1 0.5 1 POINT (-1.5 1.5) 2025-08-18 18:07:39
8 point 5 0.5 2 POINT (0 3) 2025-08-18 18:07:40
9 point 3 0.5 3 POINT (0.5 4.5) 2025-08-18 18:07:41
10 point 4 0.5 4 POINT (1.5 1.5) 2025-08-18 18:07:42
>
> # convert an sftrack object to an sftime object (modified from sftrack)
> if (require(sftrack)) {
+
+ # get an sftrack object
+ data("raccoon")
+
+ raccoon$timestamp <- as.POSIXct(raccoon$timestamp, "EST")
+
+ burstz <-
+ list(id = raccoon$animal_id, month = as.POSIXlt(raccoon$timestamp)$mon)
+
+ x_sftrack <-
+ as_sftrack(raccoon,
+ group = burstz, time = "timestamp",
+ error = NA, coords = c("longitude", "latitude")
+ )
+
+ # convert to sftime
+ st_as_sftime(x_sftrack)
+ }
Loading required package: sftrack
Spatiotemporal feature collection with 445 features and 8 fields (with 168 geometries empty)
Geometry type: POINT
Dimension: XY
Bounding box: xmin: -80.28149 ymin: 26.06761 xmax: -80.27046 ymax: 26.07706
CRS: NA
Time column with classes: 'POSIXct', 'POSIXt'.
Ranging from 2019-01-19 00:02:30 to 2019-02-01 23:02:30.
First 10 features:
animal_id latitude longitude height hdop vdop fix sft_group
1 TTP-058 NA NA NA 0.0 0.0 NO (id: TTP-058, month: 0)
2 TTP-058 26.06945 -80.27906 7 6.2 3.2 2D (id: TTP-058, month: 0)
3 TTP-058 NA NA NA 0.0 0.0 NO (id: TTP-058, month: 0)
4 TTP-058 NA NA NA 0.0 0.0 NO (id: TTP-058, month: 0)
5 TTP-058 26.06769 -80.27431 858 5.1 3.2 2D (id: TTP-058, month: 0)
6 TTP-058 26.06867 -80.27930 350 1.9 3.2 3D (id: TTP-058, month: 0)
7 TTP-058 26.06962 -80.27908 11 2.3 4.5 3D (id: TTP-058, month: 0)
8 TTP-058 26.06963 -80.27902 9 2.7 3.9 3D (id: TTP-058, month: 0)
9 TTP-058 NA NA NA 0.0 0.0 NO (id: TTP-058, month: 0)
10 TTP-058 26.06982 -80.27900 NA 2.0 3.3 3D (id: TTP-058, month: 0)
geometry timestamp
1 POINT EMPTY 2019-01-19 00:02:30
2 POINT (-80.27906 26.06945) 2019-01-19 01:02:30
3 POINT EMPTY 2019-01-19 02:02:30
4 POINT EMPTY 2019-01-19 03:02:30
5 POINT (-80.27431 26.06769) 2019-01-19 04:02:30
6 POINT (-80.2793 26.06867) 2019-01-19 05:02:30
7 POINT (-80.27908 26.06962) 2019-01-19 06:02:30
8 POINT (-80.27902 26.06963) 2019-01-19 07:02:04
9 POINT EMPTY 2019-01-19 08:02:30
10 POINT (-80.279 26.06982) 2019-01-19 17:02:30
>
> # convert an sftraj object to an sftime object (modified from sftrack)
> if (require(sftrack)) {
+
+ # get an sftrack object
+ data("raccoon")
+
+ raccoon$timestamp <- as.POSIXct(raccoon$timestamp, "EST")
+
+ burstz <-
+ list(id = raccoon$animal_id, month = as.POSIXlt(raccoon$timestamp)$mon)
+
+ x_sftraj <-
+ as_sftraj(raccoon,
+ time = "timestamp",
+ error = NA, coords = c("longitude", "latitude"),
+ group = burstz
+ )
+
+ # convert to sftime
+ st_as_sftime(x_sftraj)
+ }
Spatiotemporal feature collection with 445 features and 8 fields (with 168 geometries empty)
Geometry type: GEOMETRY
Dimension: XY
Bounding box: xmin: -80.28149 ymin: 26.06761 xmax: -80.27046 ymax: 26.07706
CRS: NA
Time column with classes: 'POSIXct', 'POSIXt'.
Ranging from 2019-01-19 00:02:30 to 2019-02-01 23:02:30.
First 10 features:
animal_id latitude longitude height hdop vdop fix sft_group
1 TTP-058 NA NA NA 0.0 0.0 NO (id: TTP-058, month: 0)
2 TTP-058 26.06945 -80.27906 7 6.2 3.2 2D (id: TTP-058, month: 0)
3 TTP-058 NA NA NA 0.0 0.0 NO (id: TTP-058, month: 0)
4 TTP-058 NA NA NA 0.0 0.0 NO (id: TTP-058, month: 0)
5 TTP-058 26.06769 -80.27431 858 5.1 3.2 2D (id: TTP-058, month: 0)
6 TTP-058 26.06867 -80.27930 350 1.9 3.2 3D (id: TTP-058, month: 0)
7 TTP-058 26.06962 -80.27908 11 2.3 4.5 3D (id: TTP-058, month: 0)
8 TTP-058 26.06963 -80.27902 9 2.7 3.9 3D (id: TTP-058, month: 0)
9 TTP-058 NA NA NA 0.0 0.0 NO (id: TTP-058, month: 0)
10 TTP-058 26.06982 -80.27900 NA 2.0 3.3 3D (id: TTP-058, month: 0)
geometry timestamp
1 POINT EMPTY 2019-01-19 00:02:30
2 POINT (-80.27906 26.06945) 2019-01-19 01:02:30
3 POINT EMPTY 2019-01-19 02:02:30
4 POINT EMPTY 2019-01-19 03:02:30
5 LINESTRING (-80.27431 26.06... 2019-01-19 04:02:30
6 LINESTRING (-80.2793 26.068... 2019-01-19 05:02:30
7 LINESTRING (-80.27908 26.06... 2019-01-19 06:02:30
8 POINT (-80.27902 26.06963) 2019-01-19 07:02:04
9 POINT EMPTY 2019-01-19 08:02:30
10 LINESTRING (-80.279 26.0698... 2019-01-19 17:02:30
>
> # convert a cubble_df object from package cubble to an sftime object
> if (requireNamespace("cubble", quietly = TRUE, versionCheck = "0.3.0")) {
+
+ # get a cubble_df object
+ data("climate_aus", package = "cubble")
+
+ # convert to sftime
+ climate_aus_sftime <-
+ st_as_sftime(climate_aus[1:4, ])
+
+ climate_aus_sftime <-
+ st_as_sftime(cubble::face_temporal(climate_aus)[1:4, ])
+
+ }
Error in loadNamespace(package, ...) :
'versionCheck' must be NULL or list with components 'op' and 'version'
Calls: requireNamespace
Execution halted
Flavor: r-devel-linux-x86_64-debian-gcc
Version: 0.3.0
Check: re-building of vignette outputs
Result: ERROR
Error(s) in re-building vignettes:
...
--- re-building ‘sftime.Rmd’ using rmarkdown
Quitting from sftime.Rmd:185-195 [unnamed-chunk-6]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<error/rlang_error>
Error in `loadNamespace()`:
! 'versionCheck' must be NULL or list with components 'op' and 'version'
---
Backtrace:
▆
1. ├─sftime::st_as_sftime(climate_aus[1:4, ])
2. └─sftime:::st_as_sftime.cubble_df(climate_aus[1:4, ])
3. └─base::requireNamespace("cubble", quietly = TRUE, versionCheck = "0.3.0")
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Error: processing vignette 'sftime.Rmd' failed with diagnostics:
'versionCheck' must be NULL or list with components 'op' and 'version'
--- failed re-building ‘sftime.Rmd’
SUMMARY: processing the following file failed:
‘sftime.Rmd’
Error: Vignette re-building failed.
Execution halted
Flavor: r-devel-linux-x86_64-debian-gcc
Version: 0.3.0
Check: examples
Result: ERROR
Running examples in ‘sftime-Ex.R’ failed
The error most likely occurred in:
> ### Name: st_as_sftime
> ### Title: Convert a foreign object to an 'sftime' object
> ### Aliases: st_as_sftime st_as_sftime.ST st_as_sftime.Track
> ### st_as_sftime.Tracks st_as_sftime.TracksCollection st_as_sftime.sftime
> ### st_as_sftime.sf st_as_sftime.stars st_as_sftime.data.frame
> ### st_as_sftime.ppp st_as_sftime.psp st_as_sftime.lpp
> ### st_as_sftime.sftrack st_as_sftime.sftraj st_as_sftime.cubble_df
>
> ### ** Examples
>
> # modified from spacetime:
> library(sp)
> library(spacetime)
>
> sp <- cbind(x = c(0,0,1), y = c(0,1,1))
> row.names(sp) <- paste("point", 1:nrow(sp), sep="")
> sp <- SpatialPoints(sp)
> time <- as.POSIXct("2010-08-05") + 3600 * (10:12)
> x <- STI(sp, time)
>
> st_as_sftime(x)
Spatiotemporal feature collection with 3 features and 0 fields
Geometry type: POINT
Dimension: XY
Bounding box: xmin: 0 ymin: 0 xmax: 1 ymax: 1
CRS: NA
Time column with classes: 'POSIXct', 'POSIXt'.
Ranging from 2010-08-05 10:00:00 to 2010-08-05 12:00:00.
st_as_sfc.x.sp. time
1 POINT (0 0) 2010-08-05 10:00:00
2 POINT (0 1) 2010-08-05 11:00:00
3 POINT (1 1) 2010-08-05 12:00:00
>
> # convert a Track object from package trajectories to an sftime object
> library(trajectories)
> x1_Track <- trajectories::rTrack(n = 100)
> x1_Track@data$speed <- sort(rnorm(length(x1_Track)))
> x1_sftime <- st_as_sftime(x1_Track)
>
> # convert a Tracks object from package trajectories to an sftime object
> x2_Tracks <- trajectories::rTracks(m = 6)
> x2_sftime <- st_as_sftime(x2_Tracks)
>
> # convert a TracksCollection object from package trajectories to an sftime object
> x3_TracksCollection <- trajectories::rTracksCollection(p = 2, m = 3, n = 50)
> x3_sftime <- st_as_sftime(x3_TracksCollection)
>
> # convert an sftime object to an sftime object
> st_as_sftime(x3_sftime)
Spatiotemporal feature collection with 300 features and 3 fields
Geometry type: POINT
Dimension: XY
Bounding box: xmin: -28.35517 ymin: -24.66491 xmax: 38.77599 ymax: 52.90631
CRS: NA
Time column with classes: 'POSIXct', 'POSIXt'.
Ranging from 1970-01-01 to 1970-01-01 04:49:00.
First 10 features:
ones tracks_name track_name st_as_sfc.x.sp.
1 1 Tracks1 Track1 POINT (-1.539007 1.932557)
2 1 Tracks1 Track1 POINT (-0.2003776 -0.1679942)
3 1 Tracks1 Track1 POINT (-2.752113 3.166629)
4 1 Tracks1 Track1 POINT (-0.2337229 -0.3806908)
5 1 Tracks1 Track1 POINT (-3.585336 3.267737)
6 1 Tracks1 Track1 POINT (-0.2504837 0.3498938)
7 1 Tracks1 Track1 POINT (-2.653028 1.426368)
8 1 Tracks1 Track1 POINT (0.6410695 -0.5117434)
9 1 Tracks1 Track1 POINT (-2.018482 1.572974)
10 1 Tracks1 Track1 POINT (1.737529 -1.27253)
time
1 1970-01-01 00:00:00
2 1970-01-01 00:00:00
3 1970-01-01 00:01:00
4 1970-01-01 00:01:00
5 1970-01-01 00:02:00
6 1970-01-01 00:02:00
7 1970-01-01 00:03:00
8 1970-01-01 00:03:00
9 1970-01-01 00:04:00
10 1970-01-01 00:04:00
>
> # convert an sf object to an sftime object
> g <- st_sfc(st_point(c(1, 2)), st_point(c(1, 3)), st_point(c(2, 3)),
+ st_point(c(2, 1)), st_point(c(3, 1)))
> x4_sf <- st_sf(a = 1:5, g, time = Sys.time() + 1:5)
> x4_sftime <- st_as_sftime(x4_sf)
>
> # convert a Tracks object from package trajectories to an sftime object
> x5_stars <- stars::read_stars(system.file("nc/bcsd_obs_1999.nc", package = "stars"))
pr, tas,
> x5_sftime <- st_as_sftime(x5_stars, time_column_name = "time")
>
> # this requires some thought to not accidentally drop time dimensions. For
> # example, setting `merge = TRUE` will drop the time dimension and thus throw
> # an error:
> ## Not run:
> ##D x5_sftime <- st_as_sftime(x5_stars, merge = TRUE, time_column_name = "time")
> ## End(Not run)
>
> # convert a data frame to an sftime object
> x5_df <-
+ data.frame(a = 1:5, g, time = Sys.time() + 1:5, stringsAsFactors = FALSE)
> x5_sftime <- st_as_sftime(x5_df)
>
> # convert a ppp object to an sftime object (modified from the sf package)
> if (require(spatstat.geom)) {
+ st_as_sftime(gorillas, time_column_name = "date")
+ }
Loading required package: spatstat.geom
Loading required package: spatstat.data
Loading required package: spatstat.univar
spatstat.univar 3.1-4
spatstat.geom 3.5-0
Spatiotemporal feature collection with 648 features and 3 fields
Geometry type: GEOMETRY
Dimension: XY
Bounding box: xmin: 580457.9 ymin: 674172.8 xmax: 585934 ymax: 678739.2
CRS: NA
Time column with class: 'Date'.
Ranging from 2006-01-06 to 2009-05-31.
First 10 features:
group season label geom date
NA <NA> <NA> window POLYGON ((584712 674237.1, ... <NA>
1 major dry point POINT (582518.4 676886.2) 2006-01-06
2 major dry point POINT (581823 677422.7) 2006-01-10
3 major dry point POINT (582131 676937.9) 2006-01-15
4 major dry point POINT (582111.9 677420) 2006-01-24
5 minor dry point POINT (582585.1 677509.7) 2006-01-27
6 major dry point POINT (582302.3 677521.6) 2006-01-28
7 major dry point POINT (583167.2 676730.5) 2006-02-01
8 major dry point POINT (583584.5 677207.1) 2006-02-03
9 major dry point POINT (583117.8 676850.3) 2006-02-13
>
> # convert a psp object to an sftime object (modified from the spatstat.geom
> # package)
> if (require(spatstat.geom)) {
+ # modified from spatstat.geom:
+ x_psp <-
+ psp(
+ runif(10), runif(10), runif(10), runif(10), window=owin(),
+ marks = data.frame(time = Sys.time() + 1:10)
+ )
+ st_as_sftime(x_psp, time_column_name = "time")
+ }
Spatiotemporal feature collection with 11 features and 1 field
Geometry type: GEOMETRY
Dimension: XY
Bounding box: xmin: 0 ymin: 0 xmax: 1 ymax: 1
CRS: NA
Time column with classes: 'POSIXct', 'POSIXt'.
Ranging from 2025-08-17 19:31:55.203449 to 2025-08-17 19:32:04.203449.
First 10 features:
label geom time
NA window POLYGON ((0 0, 1 0, 1 1, 0 ... <NA>
1 segment LINESTRING (0.6259525 0.976... 2025-08-17 19:31:55
2 segment LINESTRING (0.1771867 0.182... 2025-08-17 19:31:56
3 segment LINESTRING (0.05966493 0.68... 2025-08-17 19:31:57
4 segment LINESTRING (0.9006846 0.153... 2025-08-17 19:31:58
5 segment LINESTRING (0.7344762 0.707... 2025-08-17 19:31:59
6 segment LINESTRING (0.6586887 0.150... 2025-08-17 19:32:00
7 segment LINESTRING (0.9757892 0.408... 2025-08-17 19:32:01
8 segment LINESTRING (0.1329504 0.383... 2025-08-17 19:32:02
9 segment LINESTRING (0.6192392 0.019... 2025-08-17 19:32:03
>
> # convert an lpp object to an sftime object (modified from the
> # spatstat.linnet package)
> if (require(spatstat.geom) && require(spatstat.linnet)) {
+ # modified from spatstat.linnet:
+
+ # letter 'A'
+ v <- spatstat.geom::ppp(x=(-2):2, y=3*c(0,1,2,1,0), c(-3,3), c(-1,7))
+ edg <- cbind(1:4, 2:5)
+ edg <- rbind(edg, c(2,4))
+ letterA <- spatstat.linnet::linnet(v, edges=edg)
+
+ # points on letter A
+ xx <-
+ spatstat.geom::ppp(
+ x=c(-1.5,0,0.5,1.5), y=c(1.5,3,4.5,1.5),
+ marks = data.frame(time = Sys.time() + 1:4, a = 1:4),
+ window = spatstat.geom::owin(
+ xrange = range(c(-1.5,0,0.5,1.5)),
+ yrange = range(c(1.5,3,4.5,1.5)))
+ )
+ x_lpp <- spatstat.linnet::lpp(xx, letterA)
+
+ # convert to sftime
+ st_as_sftime(x_lpp, time_column_name = "time")
+ }
Loading required package: spatstat.linnet
Loading required package: spatstat.random
spatstat.random 3.4-1
Loading required package: spatstat.explore
Loading required package: nlme
spatstat.explore 3.5-2
Loading required package: spatstat.model
Loading required package: rpart
spatstat.model 3.4-0
spatstat.linnet 3.3-1
Spatiotemporal feature collection with 10 features and 4 fields
Geometry type: GEOMETRY
Dimension: XY
Bounding box: xmin: -3 ymin: -1 xmax: 3 ymax: 7
CRS: NA
Time column with classes: 'POSIXct', 'POSIXt'.
Ranging from 2025-08-17 19:31:55.583831 to 2025-08-17 19:31:58.583831.
label seg tp a geom time
1 window NA NA NA POLYGON ((-3 -1, 3 -1, 3 7,... <NA>
2 segment NA NA NA LINESTRING (-2 0, -1 3) <NA>
3 segment NA NA NA LINESTRING (-1 3, 0 6) <NA>
4 segment NA NA NA LINESTRING (0 6, 1 3) <NA>
5 segment NA NA NA LINESTRING (1 3, 2 0) <NA>
6 segment NA NA NA LINESTRING (-1 3, 1 3) <NA>
7 point 1 0.5 1 POINT (-1.5 1.5) 2025-08-17 19:31:55
8 point 5 0.5 2 POINT (0 3) 2025-08-17 19:31:56
9 point 3 0.5 3 POINT (0.5 4.5) 2025-08-17 19:31:57
10 point 4 0.5 4 POINT (1.5 1.5) 2025-08-17 19:31:58
>
> # convert an sftrack object to an sftime object (modified from sftrack)
> if (require(sftrack)) {
+
+ # get an sftrack object
+ data("raccoon")
+
+ raccoon$timestamp <- as.POSIXct(raccoon$timestamp, "EST")
+
+ burstz <-
+ list(id = raccoon$animal_id, month = as.POSIXlt(raccoon$timestamp)$mon)
+
+ x_sftrack <-
+ as_sftrack(raccoon,
+ group = burstz, time = "timestamp",
+ error = NA, coords = c("longitude", "latitude")
+ )
+
+ # convert to sftime
+ st_as_sftime(x_sftrack)
+ }
Loading required package: sftrack
Spatiotemporal feature collection with 445 features and 8 fields (with 168 geometries empty)
Geometry type: POINT
Dimension: XY
Bounding box: xmin: -80.28149 ymin: 26.06761 xmax: -80.27046 ymax: 26.07706
CRS: NA
Time column with classes: 'POSIXct', 'POSIXt'.
Ranging from 2019-01-18 19:02:30 to 2019-02-01 18:02:30.
First 10 features:
animal_id latitude longitude height hdop vdop fix sft_group
1 TTP-058 NA NA NA 0.0 0.0 NO (id: TTP-058, month: 0)
2 TTP-058 26.06945 -80.27906 7 6.2 3.2 2D (id: TTP-058, month: 0)
3 TTP-058 NA NA NA 0.0 0.0 NO (id: TTP-058, month: 0)
4 TTP-058 NA NA NA 0.0 0.0 NO (id: TTP-058, month: 0)
5 TTP-058 26.06769 -80.27431 858 5.1 3.2 2D (id: TTP-058, month: 0)
6 TTP-058 26.06867 -80.27930 350 1.9 3.2 3D (id: TTP-058, month: 0)
7 TTP-058 26.06962 -80.27908 11 2.3 4.5 3D (id: TTP-058, month: 0)
8 TTP-058 26.06963 -80.27902 9 2.7 3.9 3D (id: TTP-058, month: 0)
9 TTP-058 NA NA NA 0.0 0.0 NO (id: TTP-058, month: 0)
10 TTP-058 26.06982 -80.27900 NA 2.0 3.3 3D (id: TTP-058, month: 0)
geometry timestamp
1 POINT EMPTY 2019-01-18 19:02:30
2 POINT (-80.27906 26.06945) 2019-01-18 20:02:30
3 POINT EMPTY 2019-01-18 21:02:30
4 POINT EMPTY 2019-01-18 22:02:30
5 POINT (-80.27431 26.06769) 2019-01-18 23:02:30
6 POINT (-80.2793 26.06867) 2019-01-19 00:02:30
7 POINT (-80.27908 26.06962) 2019-01-19 01:02:30
8 POINT (-80.27902 26.06963) 2019-01-19 02:02:04
9 POINT EMPTY 2019-01-19 03:02:30
10 POINT (-80.279 26.06982) 2019-01-19 12:02:30
>
> # convert an sftraj object to an sftime object (modified from sftrack)
> if (require(sftrack)) {
+
+ # get an sftrack object
+ data("raccoon")
+
+ raccoon$timestamp <- as.POSIXct(raccoon$timestamp, "EST")
+
+ burstz <-
+ list(id = raccoon$animal_id, month = as.POSIXlt(raccoon$timestamp)$mon)
+
+ x_sftraj <-
+ as_sftraj(raccoon,
+ time = "timestamp",
+ error = NA, coords = c("longitude", "latitude"),
+ group = burstz
+ )
+
+ # convert to sftime
+ st_as_sftime(x_sftraj)
+ }
Spatiotemporal feature collection with 445 features and 8 fields (with 168 geometries empty)
Geometry type: GEOMETRY
Dimension: XY
Bounding box: xmin: -80.28149 ymin: 26.06761 xmax: -80.27046 ymax: 26.07706
CRS: NA
Time column with classes: 'POSIXct', 'POSIXt'.
Ranging from 2019-01-18 19:02:30 to 2019-02-01 18:02:30.
First 10 features:
animal_id latitude longitude height hdop vdop fix sft_group
1 TTP-058 NA NA NA 0.0 0.0 NO (id: TTP-058, month: 0)
2 TTP-058 26.06945 -80.27906 7 6.2 3.2 2D (id: TTP-058, month: 0)
3 TTP-058 NA NA NA 0.0 0.0 NO (id: TTP-058, month: 0)
4 TTP-058 NA NA NA 0.0 0.0 NO (id: TTP-058, month: 0)
5 TTP-058 26.06769 -80.27431 858 5.1 3.2 2D (id: TTP-058, month: 0)
6 TTP-058 26.06867 -80.27930 350 1.9 3.2 3D (id: TTP-058, month: 0)
7 TTP-058 26.06962 -80.27908 11 2.3 4.5 3D (id: TTP-058, month: 0)
8 TTP-058 26.06963 -80.27902 9 2.7 3.9 3D (id: TTP-058, month: 0)
9 TTP-058 NA NA NA 0.0 0.0 NO (id: TTP-058, month: 0)
10 TTP-058 26.06982 -80.27900 NA 2.0 3.3 3D (id: TTP-058, month: 0)
geometry timestamp
1 POINT EMPTY 2019-01-18 19:02:30
2 POINT (-80.27906 26.06945) 2019-01-18 20:02:30
3 POINT EMPTY 2019-01-18 21:02:30
4 POINT EMPTY 2019-01-18 22:02:30
5 LINESTRING (-80.27431 26.06... 2019-01-18 23:02:30
6 LINESTRING (-80.2793 26.068... 2019-01-19 00:02:30
7 LINESTRING (-80.27908 26.06... 2019-01-19 01:02:30
8 POINT (-80.27902 26.06963) 2019-01-19 02:02:04
9 POINT EMPTY 2019-01-19 03:02:30
10 LINESTRING (-80.279 26.0698... 2019-01-19 12:02:30
>
> # convert a cubble_df object from package cubble to an sftime object
> if (requireNamespace("cubble", quietly = TRUE, versionCheck = "0.3.0")) {
+
+ # get a cubble_df object
+ data("climate_aus", package = "cubble")
+
+ # convert to sftime
+ climate_aus_sftime <-
+ st_as_sftime(climate_aus[1:4, ])
+
+ climate_aus_sftime <-
+ st_as_sftime(cubble::face_temporal(climate_aus)[1:4, ])
+
+ }
Error in loadNamespace(package, ...) :
'versionCheck' must be NULL or list with components 'op' and 'version'
Calls: requireNamespace
Execution halted
Flavor: r-devel-linux-x86_64-fedora-clang
Version: 0.3.0
Check: re-building of vignette outputs
Result: ERROR
Error(s) in re-building vignettes:
--- re-building ‘sftime.Rmd’ using rmarkdown
Quitting from sftime.Rmd:185-195 [unnamed-chunk-6]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<error/rlang_error>
Error in `loadNamespace()`:
! 'versionCheck' must be NULL or list with components 'op' and 'version'
---
Backtrace:
▆
1. ├─sftime::st_as_sftime(climate_aus[1:4, ])
2. └─sftime:::st_as_sftime.cubble_df(climate_aus[1:4, ])
3. └─base::requireNamespace("cubble", quietly = TRUE, versionCheck = "0.3.0")
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Error: processing vignette 'sftime.Rmd' failed with diagnostics:
'versionCheck' must be NULL or list with components 'op' and 'version'
--- failed re-building ‘sftime.Rmd’
SUMMARY: processing the following file failed:
‘sftime.Rmd’
Error: Vignette re-building failed.
Execution halted
Flavors: r-devel-linux-x86_64-fedora-clang, r-devel-linux-x86_64-fedora-gcc, r-devel-windows-x86_64
Version: 0.3.0
Check: examples
Result: ERROR
Running examples in ‘sftime-Ex.R’ failed
The error most likely occurred in:
> ### Name: st_as_sftime
> ### Title: Convert a foreign object to an 'sftime' object
> ### Aliases: st_as_sftime st_as_sftime.ST st_as_sftime.Track
> ### st_as_sftime.Tracks st_as_sftime.TracksCollection st_as_sftime.sftime
> ### st_as_sftime.sf st_as_sftime.stars st_as_sftime.data.frame
> ### st_as_sftime.ppp st_as_sftime.psp st_as_sftime.lpp
> ### st_as_sftime.sftrack st_as_sftime.sftraj st_as_sftime.cubble_df
>
> ### ** Examples
>
> # modified from spacetime:
> library(sp)
> library(spacetime)
>
> sp <- cbind(x = c(0,0,1), y = c(0,1,1))
> row.names(sp) <- paste("point", 1:nrow(sp), sep="")
> sp <- SpatialPoints(sp)
> time <- as.POSIXct("2010-08-05") + 3600 * (10:12)
> x <- STI(sp, time)
>
> st_as_sftime(x)
Spatiotemporal feature collection with 3 features and 0 fields
Geometry type: POINT
Dimension: XY
Bounding box: xmin: 0 ymin: 0 xmax: 1 ymax: 1
CRS: NA
Time column with classes: 'POSIXct', 'POSIXt'.
Ranging from 2010-08-05 10:00:00 to 2010-08-05 12:00:00.
st_as_sfc.x.sp. time
1 POINT (0 0) 2010-08-05 10:00:00
2 POINT (0 1) 2010-08-05 11:00:00
3 POINT (1 1) 2010-08-05 12:00:00
>
> # convert a Track object from package trajectories to an sftime object
> library(trajectories)
> x1_Track <- trajectories::rTrack(n = 100)
> x1_Track@data$speed <- sort(rnorm(length(x1_Track)))
> x1_sftime <- st_as_sftime(x1_Track)
>
> # convert a Tracks object from package trajectories to an sftime object
> x2_Tracks <- trajectories::rTracks(m = 6)
> x2_sftime <- st_as_sftime(x2_Tracks)
>
> # convert a TracksCollection object from package trajectories to an sftime object
> x3_TracksCollection <- trajectories::rTracksCollection(p = 2, m = 3, n = 50)
> x3_sftime <- st_as_sftime(x3_TracksCollection)
>
> # convert an sftime object to an sftime object
> st_as_sftime(x3_sftime)
Spatiotemporal feature collection with 300 features and 3 fields
Geometry type: POINT
Dimension: XY
Bounding box: xmin: -28.35517 ymin: -24.66491 xmax: 38.77599 ymax: 52.90631
CRS: NA
Time column with classes: 'POSIXct', 'POSIXt'.
Ranging from 1970-01-01 to 1970-01-01 04:49:00.
First 10 features:
ones tracks_name track_name st_as_sfc.x.sp.
1 1 Tracks1 Track1 POINT (-1.539007 1.932557)
2 1 Tracks1 Track1 POINT (-0.2003776 -0.1679942)
3 1 Tracks1 Track1 POINT (-2.752113 3.166629)
4 1 Tracks1 Track1 POINT (-0.2337229 -0.3806908)
5 1 Tracks1 Track1 POINT (-3.585336 3.267737)
6 1 Tracks1 Track1 POINT (-0.2504837 0.3498938)
7 1 Tracks1 Track1 POINT (-2.653028 1.426368)
8 1 Tracks1 Track1 POINT (0.6410695 -0.5117434)
9 1 Tracks1 Track1 POINT (-2.018482 1.572974)
10 1 Tracks1 Track1 POINT (1.737529 -1.27253)
time
1 1970-01-01 00:00:00
2 1970-01-01 00:00:00
3 1970-01-01 00:01:00
4 1970-01-01 00:01:00
5 1970-01-01 00:02:00
6 1970-01-01 00:02:00
7 1970-01-01 00:03:00
8 1970-01-01 00:03:00
9 1970-01-01 00:04:00
10 1970-01-01 00:04:00
>
> # convert an sf object to an sftime object
> g <- st_sfc(st_point(c(1, 2)), st_point(c(1, 3)), st_point(c(2, 3)),
+ st_point(c(2, 1)), st_point(c(3, 1)))
> x4_sf <- st_sf(a = 1:5, g, time = Sys.time() + 1:5)
> x4_sftime <- st_as_sftime(x4_sf)
>
> # convert a Tracks object from package trajectories to an sftime object
> x5_stars <- stars::read_stars(system.file("nc/bcsd_obs_1999.nc", package = "stars"))
pr, tas,
> x5_sftime <- st_as_sftime(x5_stars, time_column_name = "time")
>
> # this requires some thought to not accidentally drop time dimensions. For
> # example, setting `merge = TRUE` will drop the time dimension and thus throw
> # an error:
> ## Not run:
> ##D x5_sftime <- st_as_sftime(x5_stars, merge = TRUE, time_column_name = "time")
> ## End(Not run)
>
> # convert a data frame to an sftime object
> x5_df <-
+ data.frame(a = 1:5, g, time = Sys.time() + 1:5, stringsAsFactors = FALSE)
> x5_sftime <- st_as_sftime(x5_df)
>
> # convert a ppp object to an sftime object (modified from the sf package)
> if (require(spatstat.geom)) {
+ st_as_sftime(gorillas, time_column_name = "date")
+ }
Loading required package: spatstat.geom
Loading required package: spatstat.data
Loading required package: spatstat.univar
spatstat.univar 3.1-4
spatstat.geom 3.5-0
Spatiotemporal feature collection with 648 features and 3 fields
Geometry type: GEOMETRY
Dimension: XY
Bounding box: xmin: 580457.9 ymin: 674172.8 xmax: 585934 ymax: 678739.2
CRS: NA
Time column with class: 'Date'.
Ranging from 2006-01-06 to 2009-05-31.
First 10 features:
group season label geom date
NA <NA> <NA> window POLYGON ((584712 674237.1, ... <NA>
1 major dry point POINT (582518.4 676886.2) 2006-01-06
2 major dry point POINT (581823 677422.7) 2006-01-10
3 major dry point POINT (582131 676937.9) 2006-01-15
4 major dry point POINT (582111.9 677420) 2006-01-24
5 minor dry point POINT (582585.1 677509.7) 2006-01-27
6 major dry point POINT (582302.3 677521.6) 2006-01-28
7 major dry point POINT (583167.2 676730.5) 2006-02-01
8 major dry point POINT (583584.5 677207.1) 2006-02-03
9 major dry point POINT (583117.8 676850.3) 2006-02-13
>
> # convert a psp object to an sftime object (modified from the spatstat.geom
> # package)
> if (require(spatstat.geom)) {
+ # modified from spatstat.geom:
+ x_psp <-
+ psp(
+ runif(10), runif(10), runif(10), runif(10), window=owin(),
+ marks = data.frame(time = Sys.time() + 1:10)
+ )
+ st_as_sftime(x_psp, time_column_name = "time")
+ }
Spatiotemporal feature collection with 11 features and 1 field
Geometry type: GEOMETRY
Dimension: XY
Bounding box: xmin: 0 ymin: 0 xmax: 1 ymax: 1
CRS: NA
Time column with classes: 'POSIXct', 'POSIXt'.
Ranging from 2025-08-17 10:56:04.645036 to 2025-08-17 10:56:13.645036.
First 10 features:
label geom time
NA window POLYGON ((0 0, 1 0, 1 1, 0 ... <NA>
1 segment LINESTRING (0.6259525 0.976... 2025-08-17 10:56:04
2 segment LINESTRING (0.1771867 0.182... 2025-08-17 10:56:05
3 segment LINESTRING (0.05966493 0.68... 2025-08-17 10:56:06
4 segment LINESTRING (0.9006846 0.153... 2025-08-17 10:56:07
5 segment LINESTRING (0.7344762 0.707... 2025-08-17 10:56:08
6 segment LINESTRING (0.6586887 0.150... 2025-08-17 10:56:09
7 segment LINESTRING (0.9757892 0.408... 2025-08-17 10:56:10
8 segment LINESTRING (0.1329504 0.383... 2025-08-17 10:56:11
9 segment LINESTRING (0.6192392 0.019... 2025-08-17 10:56:12
>
> # convert an lpp object to an sftime object (modified from the
> # spatstat.linnet package)
> if (require(spatstat.geom) && require(spatstat.linnet)) {
+ # modified from spatstat.linnet:
+
+ # letter 'A'
+ v <- spatstat.geom::ppp(x=(-2):2, y=3*c(0,1,2,1,0), c(-3,3), c(-1,7))
+ edg <- cbind(1:4, 2:5)
+ edg <- rbind(edg, c(2,4))
+ letterA <- spatstat.linnet::linnet(v, edges=edg)
+
+ # points on letter A
+ xx <-
+ spatstat.geom::ppp(
+ x=c(-1.5,0,0.5,1.5), y=c(1.5,3,4.5,1.5),
+ marks = data.frame(time = Sys.time() + 1:4, a = 1:4),
+ window = spatstat.geom::owin(
+ xrange = range(c(-1.5,0,0.5,1.5)),
+ yrange = range(c(1.5,3,4.5,1.5)))
+ )
+ x_lpp <- spatstat.linnet::lpp(xx, letterA)
+
+ # convert to sftime
+ st_as_sftime(x_lpp, time_column_name = "time")
+ }
Loading required package: spatstat.linnet
Loading required package: spatstat.random
spatstat.random 3.4-1
Loading required package: spatstat.explore
Loading required package: nlme
spatstat.explore 3.5-2
Loading required package: spatstat.model
Loading required package: rpart
spatstat.model 3.4-0
spatstat.linnet 3.3-1
Spatiotemporal feature collection with 10 features and 4 fields
Geometry type: GEOMETRY
Dimension: XY
Bounding box: xmin: -3 ymin: -1 xmax: 3 ymax: 7
CRS: NA
Time column with classes: 'POSIXct', 'POSIXt'.
Ranging from 2025-08-17 10:56:06.064714 to 2025-08-17 10:56:09.064714.
label seg tp a geom time
1 window NA NA NA POLYGON ((-3 -1, 3 -1, 3 7,... <NA>
2 segment NA NA NA LINESTRING (-2 0, -1 3) <NA>
3 segment NA NA NA LINESTRING (-1 3, 0 6) <NA>
4 segment NA NA NA LINESTRING (0 6, 1 3) <NA>
5 segment NA NA NA LINESTRING (1 3, 2 0) <NA>
6 segment NA NA NA LINESTRING (-1 3, 1 3) <NA>
7 point 1 0.5 1 POINT (-1.5 1.5) 2025-08-17 10:56:06
8 point 5 0.5 2 POINT (0 3) 2025-08-17 10:56:07
9 point 3 0.5 3 POINT (0.5 4.5) 2025-08-17 10:56:08
10 point 4 0.5 4 POINT (1.5 1.5) 2025-08-17 10:56:09
>
> # convert an sftrack object to an sftime object (modified from sftrack)
> if (require(sftrack)) {
+
+ # get an sftrack object
+ data("raccoon")
+
+ raccoon$timestamp <- as.POSIXct(raccoon$timestamp, "EST")
+
+ burstz <-
+ list(id = raccoon$animal_id, month = as.POSIXlt(raccoon$timestamp)$mon)
+
+ x_sftrack <-
+ as_sftrack(raccoon,
+ group = burstz, time = "timestamp",
+ error = NA, coords = c("longitude", "latitude")
+ )
+
+ # convert to sftime
+ st_as_sftime(x_sftrack)
+ }
Loading required package: sftrack
Spatiotemporal feature collection with 445 features and 8 fields (with 168 geometries empty)
Geometry type: POINT
Dimension: XY
Bounding box: xmin: -80.28149 ymin: 26.06761 xmax: -80.27046 ymax: 26.07706
CRS: NA
Time column with classes: 'POSIXct', 'POSIXt'.
Ranging from 2019-01-18 19:02:30 to 2019-02-01 18:02:30.
First 10 features:
animal_id latitude longitude height hdop vdop fix sft_group
1 TTP-058 NA NA NA 0.0 0.0 NO (id: TTP-058, month: 0)
2 TTP-058 26.06945 -80.27906 7 6.2 3.2 2D (id: TTP-058, month: 0)
3 TTP-058 NA NA NA 0.0 0.0 NO (id: TTP-058, month: 0)
4 TTP-058 NA NA NA 0.0 0.0 NO (id: TTP-058, month: 0)
5 TTP-058 26.06769 -80.27431 858 5.1 3.2 2D (id: TTP-058, month: 0)
6 TTP-058 26.06867 -80.27930 350 1.9 3.2 3D (id: TTP-058, month: 0)
7 TTP-058 26.06962 -80.27908 11 2.3 4.5 3D (id: TTP-058, month: 0)
8 TTP-058 26.06963 -80.27902 9 2.7 3.9 3D (id: TTP-058, month: 0)
9 TTP-058 NA NA NA 0.0 0.0 NO (id: TTP-058, month: 0)
10 TTP-058 26.06982 -80.27900 NA 2.0 3.3 3D (id: TTP-058, month: 0)
geometry timestamp
1 POINT EMPTY 2019-01-18 19:02:30
2 POINT (-80.27906 26.06945) 2019-01-18 20:02:30
3 POINT EMPTY 2019-01-18 21:02:30
4 POINT EMPTY 2019-01-18 22:02:30
5 POINT (-80.27431 26.06769) 2019-01-18 23:02:30
6 POINT (-80.2793 26.06867) 2019-01-19 00:02:30
7 POINT (-80.27908 26.06962) 2019-01-19 01:02:30
8 POINT (-80.27902 26.06963) 2019-01-19 02:02:04
9 POINT EMPTY 2019-01-19 03:02:30
10 POINT (-80.279 26.06982) 2019-01-19 12:02:30
>
> # convert an sftraj object to an sftime object (modified from sftrack)
> if (require(sftrack)) {
+
+ # get an sftrack object
+ data("raccoon")
+
+ raccoon$timestamp <- as.POSIXct(raccoon$timestamp, "EST")
+
+ burstz <-
+ list(id = raccoon$animal_id, month = as.POSIXlt(raccoon$timestamp)$mon)
+
+ x_sftraj <-
+ as_sftraj(raccoon,
+ time = "timestamp",
+ error = NA, coords = c("longitude", "latitude"),
+ group = burstz
+ )
+
+ # convert to sftime
+ st_as_sftime(x_sftraj)
+ }
Spatiotemporal feature collection with 445 features and 8 fields (with 168 geometries empty)
Geometry type: GEOMETRY
Dimension: XY
Bounding box: xmin: -80.28149 ymin: 26.06761 xmax: -80.27046 ymax: 26.07706
CRS: NA
Time column with classes: 'POSIXct', 'POSIXt'.
Ranging from 2019-01-18 19:02:30 to 2019-02-01 18:02:30.
First 10 features:
animal_id latitude longitude height hdop vdop fix sft_group
1 TTP-058 NA NA NA 0.0 0.0 NO (id: TTP-058, month: 0)
2 TTP-058 26.06945 -80.27906 7 6.2 3.2 2D (id: TTP-058, month: 0)
3 TTP-058 NA NA NA 0.0 0.0 NO (id: TTP-058, month: 0)
4 TTP-058 NA NA NA 0.0 0.0 NO (id: TTP-058, month: 0)
5 TTP-058 26.06769 -80.27431 858 5.1 3.2 2D (id: TTP-058, month: 0)
6 TTP-058 26.06867 -80.27930 350 1.9 3.2 3D (id: TTP-058, month: 0)
7 TTP-058 26.06962 -80.27908 11 2.3 4.5 3D (id: TTP-058, month: 0)
8 TTP-058 26.06963 -80.27902 9 2.7 3.9 3D (id: TTP-058, month: 0)
9 TTP-058 NA NA NA 0.0 0.0 NO (id: TTP-058, month: 0)
10 TTP-058 26.06982 -80.27900 NA 2.0 3.3 3D (id: TTP-058, month: 0)
geometry timestamp
1 POINT EMPTY 2019-01-18 19:02:30
2 POINT (-80.27906 26.06945) 2019-01-18 20:02:30
3 POINT EMPTY 2019-01-18 21:02:30
4 POINT EMPTY 2019-01-18 22:02:30
5 LINESTRING (-80.27431 26.06... 2019-01-18 23:02:30
6 LINESTRING (-80.2793 26.068... 2019-01-19 00:02:30
7 LINESTRING (-80.27908 26.06... 2019-01-19 01:02:30
8 POINT (-80.27902 26.06963) 2019-01-19 02:02:04
9 POINT EMPTY 2019-01-19 03:02:30
10 LINESTRING (-80.279 26.0698... 2019-01-19 12:02:30
>
> # convert a cubble_df object from package cubble to an sftime object
> if (requireNamespace("cubble", quietly = TRUE, versionCheck = "0.3.0")) {
+
+ # get a cubble_df object
+ data("climate_aus", package = "cubble")
+
+ # convert to sftime
+ climate_aus_sftime <-
+ st_as_sftime(climate_aus[1:4, ])
+
+ climate_aus_sftime <-
+ st_as_sftime(cubble::face_temporal(climate_aus)[1:4, ])
+
+ }
Error in loadNamespace(package, ...) :
'versionCheck' must be NULL or list with components 'op' and 'version'
Calls: requireNamespace
Execution halted
Flavor: r-devel-linux-x86_64-fedora-gcc
Version: 0.3.0
Check: examples
Result: ERROR
Running examples in 'sftime-Ex.R' failed
The error most likely occurred in:
> ### Name: st_as_sftime
> ### Title: Convert a foreign object to an 'sftime' object
> ### Aliases: st_as_sftime st_as_sftime.ST st_as_sftime.Track
> ### st_as_sftime.Tracks st_as_sftime.TracksCollection st_as_sftime.sftime
> ### st_as_sftime.sf st_as_sftime.stars st_as_sftime.data.frame
> ### st_as_sftime.ppp st_as_sftime.psp st_as_sftime.lpp
> ### st_as_sftime.sftrack st_as_sftime.sftraj st_as_sftime.cubble_df
>
> ### ** Examples
>
> # modified from spacetime:
> library(sp)
> library(spacetime)
>
> sp <- cbind(x = c(0,0,1), y = c(0,1,1))
> row.names(sp) <- paste("point", 1:nrow(sp), sep="")
> sp <- SpatialPoints(sp)
> time <- as.POSIXct("2010-08-05") + 3600 * (10:12)
> x <- STI(sp, time)
>
> st_as_sftime(x)
Spatiotemporal feature collection with 3 features and 0 fields
Geometry type: POINT
Dimension: XY
Bounding box: xmin: 0 ymin: 0 xmax: 1 ymax: 1
CRS: NA
Time column with classes: 'POSIXct', 'POSIXt'.
Ranging from 2010-08-05 10:00:00 to 2010-08-05 12:00:00.
st_as_sfc.x.sp. time
1 POINT (0 0) 2010-08-05 10:00:00
2 POINT (0 1) 2010-08-05 11:00:00
3 POINT (1 1) 2010-08-05 12:00:00
>
> # convert a Track object from package trajectories to an sftime object
> library(trajectories)
> x1_Track <- trajectories::rTrack(n = 100)
> x1_Track@data$speed <- sort(rnorm(length(x1_Track)))
> x1_sftime <- st_as_sftime(x1_Track)
>
> # convert a Tracks object from package trajectories to an sftime object
> x2_Tracks <- trajectories::rTracks(m = 6)
> x2_sftime <- st_as_sftime(x2_Tracks)
>
> # convert a TracksCollection object from package trajectories to an sftime object
> x3_TracksCollection <- trajectories::rTracksCollection(p = 2, m = 3, n = 50)
> x3_sftime <- st_as_sftime(x3_TracksCollection)
>
> # convert an sftime object to an sftime object
> st_as_sftime(x3_sftime)
Spatiotemporal feature collection with 300 features and 3 fields
Geometry type: POINT
Dimension: XY
Bounding box: xmin: -28.35517 ymin: -24.66491 xmax: 38.77599 ymax: 52.90631
CRS: NA
Time column with classes: 'POSIXct', 'POSIXt'.
Ranging from 1970-01-01 to 1970-01-01 04:49:00.
First 10 features:
ones tracks_name track_name st_as_sfc.x.sp.
1 1 Tracks1 Track1 POINT (-1.539007 1.932557)
2 1 Tracks1 Track1 POINT (-0.2003776 -0.1679942)
3 1 Tracks1 Track1 POINT (-2.752113 3.166629)
4 1 Tracks1 Track1 POINT (-0.2337229 -0.3806908)
5 1 Tracks1 Track1 POINT (-3.585336 3.267737)
6 1 Tracks1 Track1 POINT (-0.2504837 0.3498938)
7 1 Tracks1 Track1 POINT (-2.653028 1.426368)
8 1 Tracks1 Track1 POINT (0.6410695 -0.5117434)
9 1 Tracks1 Track1 POINT (-2.018482 1.572974)
10 1 Tracks1 Track1 POINT (1.737529 -1.27253)
time
1 1970-01-01 00:00:00
2 1970-01-01 00:00:00
3 1970-01-01 00:01:00
4 1970-01-01 00:01:00
5 1970-01-01 00:02:00
6 1970-01-01 00:02:00
7 1970-01-01 00:03:00
8 1970-01-01 00:03:00
9 1970-01-01 00:04:00
10 1970-01-01 00:04:00
>
> # convert an sf object to an sftime object
> g <- st_sfc(st_point(c(1, 2)), st_point(c(1, 3)), st_point(c(2, 3)),
+ st_point(c(2, 1)), st_point(c(3, 1)))
> x4_sf <- st_sf(a = 1:5, g, time = Sys.time() + 1:5)
> x4_sftime <- st_as_sftime(x4_sf)
>
> # convert a Tracks object from package trajectories to an sftime object
> x5_stars <- stars::read_stars(system.file("nc/bcsd_obs_1999.nc", package = "stars"))
pr, tas,
> x5_sftime <- st_as_sftime(x5_stars, time_column_name = "time")
>
> # this requires some thought to not accidentally drop time dimensions. For
> # example, setting `merge = TRUE` will drop the time dimension and thus throw
> # an error:
> ## Not run:
> ##D x5_sftime <- st_as_sftime(x5_stars, merge = TRUE, time_column_name = "time")
> ## End(Not run)
>
> # convert a data frame to an sftime object
> x5_df <-
+ data.frame(a = 1:5, g, time = Sys.time() + 1:5, stringsAsFactors = FALSE)
> x5_sftime <- st_as_sftime(x5_df)
>
> # convert a ppp object to an sftime object (modified from the sf package)
> if (require(spatstat.geom)) {
+ st_as_sftime(gorillas, time_column_name = "date")
+ }
Loading required package: spatstat.geom
Loading required package: spatstat.data
Loading required package: spatstat.univar
spatstat.univar 3.1-4
spatstat.geom 3.5-0
Spatiotemporal feature collection with 648 features and 3 fields
Geometry type: GEOMETRY
Dimension: XY
Bounding box: xmin: 580457.9 ymin: 674172.8 xmax: 585934 ymax: 678739.2
CRS: NA
Time column with class: 'Date'.
Ranging from 2006-01-06 to 2009-05-31.
First 10 features:
group season label geom date
NA <NA> <NA> window POLYGON ((584712 674237.1, ... <NA>
1 major dry point POINT (582518.4 676886.2) 2006-01-06
2 major dry point POINT (581823 677422.7) 2006-01-10
3 major dry point POINT (582131 676937.9) 2006-01-15
4 major dry point POINT (582111.9 677420) 2006-01-24
5 minor dry point POINT (582585.1 677509.7) 2006-01-27
6 major dry point POINT (582302.3 677521.6) 2006-01-28
7 major dry point POINT (583167.2 676730.5) 2006-02-01
8 major dry point POINT (583584.5 677207.1) 2006-02-03
9 major dry point POINT (583117.8 676850.3) 2006-02-13
>
> # convert a psp object to an sftime object (modified from the spatstat.geom
> # package)
> if (require(spatstat.geom)) {
+ # modified from spatstat.geom:
+ x_psp <-
+ psp(
+ runif(10), runif(10), runif(10), runif(10), window=owin(),
+ marks = data.frame(time = Sys.time() + 1:10)
+ )
+ st_as_sftime(x_psp, time_column_name = "time")
+ }
Spatiotemporal feature collection with 11 features and 1 field
Geometry type: GEOMETRY
Dimension: XY
Bounding box: xmin: 0 ymin: 0 xmax: 1 ymax: 1
CRS: NA
Time column with classes: 'POSIXct', 'POSIXt'.
Ranging from 2025-08-17 18:33:29.085004 to 2025-08-17 18:33:38.085004.
First 10 features:
label geom time
NA window POLYGON ((0 0, 1 0, 1 1, 0 ... <NA>
1 segment LINESTRING (0.6259525 0.976... 2025-08-17 18:33:29
2 segment LINESTRING (0.1771867 0.182... 2025-08-17 18:33:30
3 segment LINESTRING (0.05966493 0.68... 2025-08-17 18:33:31
4 segment LINESTRING (0.9006846 0.153... 2025-08-17 18:33:32
5 segment LINESTRING (0.7344762 0.707... 2025-08-17 18:33:33
6 segment LINESTRING (0.6586887 0.150... 2025-08-17 18:33:34
7 segment LINESTRING (0.9757892 0.408... 2025-08-17 18:33:35
8 segment LINESTRING (0.1329504 0.383... 2025-08-17 18:33:36
9 segment LINESTRING (0.6192392 0.019... 2025-08-17 18:33:37
>
> # convert an lpp object to an sftime object (modified from the
> # spatstat.linnet package)
> if (require(spatstat.geom) && require(spatstat.linnet)) {
+ # modified from spatstat.linnet:
+
+ # letter 'A'
+ v <- spatstat.geom::ppp(x=(-2):2, y=3*c(0,1,2,1,0), c(-3,3), c(-1,7))
+ edg <- cbind(1:4, 2:5)
+ edg <- rbind(edg, c(2,4))
+ letterA <- spatstat.linnet::linnet(v, edges=edg)
+
+ # points on letter A
+ xx <-
+ spatstat.geom::ppp(
+ x=c(-1.5,0,0.5,1.5), y=c(1.5,3,4.5,1.5),
+ marks = data.frame(time = Sys.time() + 1:4, a = 1:4),
+ window = spatstat.geom::owin(
+ xrange = range(c(-1.5,0,0.5,1.5)),
+ yrange = range(c(1.5,3,4.5,1.5)))
+ )
+ x_lpp <- spatstat.linnet::lpp(xx, letterA)
+
+ # convert to sftime
+ st_as_sftime(x_lpp, time_column_name = "time")
+ }
Loading required package: spatstat.linnet
Loading required package: spatstat.random
spatstat.random 3.4-1
Loading required package: spatstat.explore
Loading required package: nlme
spatstat.explore 3.5-2
Loading required package: spatstat.model
Loading required package: rpart
spatstat.model 3.4-0
spatstat.linnet 3.3-1
Spatiotemporal feature collection with 10 features and 4 fields
Geometry type: GEOMETRY
Dimension: XY
Bounding box: xmin: -3 ymin: -1 xmax: 3 ymax: 7
CRS: NA
Time column with classes: 'POSIXct', 'POSIXt'.
Ranging from 2025-08-17 18:33:29.676115 to 2025-08-17 18:33:32.676115.
label seg tp a geom time
1 window NA NA NA POLYGON ((-3 -1, 3 -1, 3 7,... <NA>
2 segment NA NA NA LINESTRING (-2 0, -1 3) <NA>
3 segment NA NA NA LINESTRING (-1 3, 0 6) <NA>
4 segment NA NA NA LINESTRING (0 6, 1 3) <NA>
5 segment NA NA NA LINESTRING (1 3, 2 0) <NA>
6 segment NA NA NA LINESTRING (-1 3, 1 3) <NA>
7 point 1 0.5 1 POINT (-1.5 1.5) 2025-08-17 18:33:29
8 point 5 0.5 2 POINT (0 3) 2025-08-17 18:33:30
9 point 3 0.5 3 POINT (0.5 4.5) 2025-08-17 18:33:31
10 point 4 0.5 4 POINT (1.5 1.5) 2025-08-17 18:33:32
>
> # convert an sftrack object to an sftime object (modified from sftrack)
> if (require(sftrack)) {
+
+ # get an sftrack object
+ data("raccoon")
+
+ raccoon$timestamp <- as.POSIXct(raccoon$timestamp, "EST")
+
+ burstz <-
+ list(id = raccoon$animal_id, month = as.POSIXlt(raccoon$timestamp)$mon)
+
+ x_sftrack <-
+ as_sftrack(raccoon,
+ group = burstz, time = "timestamp",
+ error = NA, coords = c("longitude", "latitude")
+ )
+
+ # convert to sftime
+ st_as_sftime(x_sftrack)
+ }
Loading required package: sftrack
Spatiotemporal feature collection with 445 features and 8 fields (with 168 geometries empty)
Geometry type: POINT
Dimension: XY
Bounding box: xmin: -80.28149 ymin: 26.06761 xmax: -80.27046 ymax: 26.07706
CRS: NA
Time column with classes: 'POSIXct', 'POSIXt'.
Ranging from 2019-01-18 19:02:30 to 2019-02-01 18:02:30.
First 10 features:
animal_id latitude longitude height hdop vdop fix sft_group
1 TTP-058 NA NA NA 0.0 0.0 NO (id: TTP-058, month: 0)
2 TTP-058 26.06945 -80.27906 7 6.2 3.2 2D (id: TTP-058, month: 0)
3 TTP-058 NA NA NA 0.0 0.0 NO (id: TTP-058, month: 0)
4 TTP-058 NA NA NA 0.0 0.0 NO (id: TTP-058, month: 0)
5 TTP-058 26.06769 -80.27431 858 5.1 3.2 2D (id: TTP-058, month: 0)
6 TTP-058 26.06867 -80.27930 350 1.9 3.2 3D (id: TTP-058, month: 0)
7 TTP-058 26.06962 -80.27908 11 2.3 4.5 3D (id: TTP-058, month: 0)
8 TTP-058 26.06963 -80.27902 9 2.7 3.9 3D (id: TTP-058, month: 0)
9 TTP-058 NA NA NA 0.0 0.0 NO (id: TTP-058, month: 0)
10 TTP-058 26.06982 -80.27900 NA 2.0 3.3 3D (id: TTP-058, month: 0)
geometry timestamp
1 POINT EMPTY 2019-01-18 19:02:30
2 POINT (-80.27906 26.06945) 2019-01-18 20:02:30
3 POINT EMPTY 2019-01-18 21:02:30
4 POINT EMPTY 2019-01-18 22:02:30
5 POINT (-80.27431 26.06769) 2019-01-18 23:02:30
6 POINT (-80.2793 26.06867) 2019-01-19 00:02:30
7 POINT (-80.27908 26.06962) 2019-01-19 01:02:30
8 POINT (-80.27902 26.06963) 2019-01-19 02:02:04
9 POINT EMPTY 2019-01-19 03:02:30
10 POINT (-80.279 26.06982) 2019-01-19 12:02:30
>
> # convert an sftraj object to an sftime object (modified from sftrack)
> if (require(sftrack)) {
+
+ # get an sftrack object
+ data("raccoon")
+
+ raccoon$timestamp <- as.POSIXct(raccoon$timestamp, "EST")
+
+ burstz <-
+ list(id = raccoon$animal_id, month = as.POSIXlt(raccoon$timestamp)$mon)
+
+ x_sftraj <-
+ as_sftraj(raccoon,
+ time = "timestamp",
+ error = NA, coords = c("longitude", "latitude"),
+ group = burstz
+ )
+
+ # convert to sftime
+ st_as_sftime(x_sftraj)
+ }
Spatiotemporal feature collection with 445 features and 8 fields (with 168 geometries empty)
Geometry type: GEOMETRY
Dimension: XY
Bounding box: xmin: -80.28149 ymin: 26.06761 xmax: -80.27046 ymax: 26.07706
CRS: NA
Time column with classes: 'POSIXct', 'POSIXt'.
Ranging from 2019-01-18 19:02:30 to 2019-02-01 18:02:30.
First 10 features:
animal_id latitude longitude height hdop vdop fix sft_group
1 TTP-058 NA NA NA 0.0 0.0 NO (id: TTP-058, month: 0)
2 TTP-058 26.06945 -80.27906 7 6.2 3.2 2D (id: TTP-058, month: 0)
3 TTP-058 NA NA NA 0.0 0.0 NO (id: TTP-058, month: 0)
4 TTP-058 NA NA NA 0.0 0.0 NO (id: TTP-058, month: 0)
5 TTP-058 26.06769 -80.27431 858 5.1 3.2 2D (id: TTP-058, month: 0)
6 TTP-058 26.06867 -80.27930 350 1.9 3.2 3D (id: TTP-058, month: 0)
7 TTP-058 26.06962 -80.27908 11 2.3 4.5 3D (id: TTP-058, month: 0)
8 TTP-058 26.06963 -80.27902 9 2.7 3.9 3D (id: TTP-058, month: 0)
9 TTP-058 NA NA NA 0.0 0.0 NO (id: TTP-058, month: 0)
10 TTP-058 26.06982 -80.27900 NA 2.0 3.3 3D (id: TTP-058, month: 0)
geometry timestamp
1 POINT EMPTY 2019-01-18 19:02:30
2 POINT (-80.27906 26.06945) 2019-01-18 20:02:30
3 POINT EMPTY 2019-01-18 21:02:30
4 POINT EMPTY 2019-01-18 22:02:30
5 LINESTRING (-80.27431 26.06... 2019-01-18 23:02:30
6 LINESTRING (-80.2793 26.068... 2019-01-19 00:02:30
7 LINESTRING (-80.27908 26.06... 2019-01-19 01:02:30
8 POINT (-80.27902 26.06963) 2019-01-19 02:02:04
9 POINT EMPTY 2019-01-19 03:02:30
10 LINESTRING (-80.279 26.0698... 2019-01-19 12:02:30
>
> # convert a cubble_df object from package cubble to an sftime object
> if (requireNamespace("cubble", quietly = TRUE, versionCheck = "0.3.0")) {
+
+ # get a cubble_df object
+ data("climate_aus", package = "cubble")
+
+ # convert to sftime
+ climate_aus_sftime <-
+ st_as_sftime(climate_aus[1:4, ])
+
+ climate_aus_sftime <-
+ st_as_sftime(cubble::face_temporal(climate_aus)[1:4, ])
+
+ }
Error in loadNamespace(package, ...) :
'versionCheck' must be NULL or list with components 'op' and 'version'
Calls: requireNamespace
Execution halted
Flavor: r-devel-windows-x86_64