set_datetime | R Documentation |
This function helps format standard date/time columns in a tibble
using
Darwin Core Standard. Users should make use of the
lubridate package to
format their dates so corella can read them correctly.
In practice this is no different from using mutate()
, but gives some
informative errors, and serves as a useful lookup for how spatial fields are
represented in the Darwin Core Standard.
set_datetime(
.df,
eventDate = NULL,
year = NULL,
month = NULL,
day = NULL,
eventTime = NULL,
.keep = "unused",
.messages = TRUE
)
.df |
A |
eventDate |
The date or date + time that the observation/event occurred. |
year |
The year of the observation/event. |
month |
The month of the observation/event. |
day |
The day of the observation/event. |
eventTime |
The time of the event. Use this term for Event data.
Date + time information for observations is accepted in |
.keep |
Control which columns from .data are retained in the output.
Note that unlike |
.messages |
(logical) Should informative messages be shown? Defaults to
|
Example values are:
eventDate
should be class Date
or POSITct
. We suggest using the
lubridate package to define define your date format using functions like
ymd()
, mdy
, dmy()
, or if including date + time, ymd_hms()
,
ymd_hm()
, or ymd_h()
.
A tibble
with the requested columns added/reformatted.
df <- tibble::tibble(
name = c("Crinia Signifera", "Crinia Signifera", "Litoria peronii"),
latitude = c(-35.27, -35.24, -35.83),
longitude = c(149.33, 149.34, 149.34),
date = c("2010-10-14", "2010-10-14", "2010-10-14"),
time = c("10:08:12", "13:01:45", "14:02:33")
)
# Use the lubridate package to format date + time information
# eventDate accepts date + time
df |>
set_datetime(
eventDate = lubridate::ymd_hms(paste(date, time))
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.