st_time | R Documentation |
Get, set, or replace time information
st_time(obj, ...) st_time(x, ...) <- value ## S3 method for class 'sftime' st_time(obj, ...) ## S3 replacement method for class 'sf' st_time(x, ..., time_column_name = "time") <- value ## S3 replacement method for class 'sftime' st_time(x, ...) <- value st_set_time(x, value, ...) st_drop_time(x)
obj |
An object of class |
... |
Additional arguments; Ignored. |
x |
An object of class |
value |
An object for which |
time_column_name |
Character value; The name of the column to set as
active time column in |
In case value
is character and x
is of class
sftime
, the active time column (as indicated by attribute
time_column
) is set to x[[value]]
.
The replacement function applied to sftime
objects will overwrite the
active time column, if value
is NULL
, it will remove it and
coerce x
to an sftime
object.
st_drop_time
drops the time column of its argument, and
reclasses it accordingly.
st_time
returns the content of the active time column of an
sftime
object.
Assigning an object for which is_sortable
returns TRUE
to an sf
object creates an sftime
object.
Assigning an object for which is_sortable
returns TRUE
to an sftime
object replaces the active time column by this object.
# from sftime object g <- st_sfc(st_point(1:2)) time <- Sys.time() x <- st_sftime(a = 3, g, time = time) st_time(x) ## assign a vector with time information # to sf object x <- st_sf(a = 3, g) st_time(x) <- time x # to sftime object x <- st_sftime(a = 3, g, time = time) st_time(x) <- Sys.time() ## remove time column from sftime object st_time(x) <- NULL ## pipe-friendly # assign time column to sf object x <- st_sf(a = 3, g) x <- st_set_time(x, time) # remove time column from sftime object st_set_time(x, NULL) ## drop time column and class # same as x <- st_set_time(x, NULL) st_drop_time(x)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.