ic_event: Create ical object from properties_core inputs

View source: R/ic_event.R

ic_eventR Documentation

Create ical object from properties_core inputs

Description

Create an ical event using either POSIXct type or character type with format parameters.

Usage

ic_event(
  uid = ic_guid(),
  start_time = as.POSIXct(round.POSIXt(Sys.time(), units = "hours")),
  end_time = 1,
  format = "%Y-%m-%d %H:%M",
  summary = "ical event",
  more_properties = FALSE,
  event_properties = calendar::properties
)

Arguments

uid

the unique id of the event, by default generated by ic_uid()

start_time

start time, by default the start time plus one hour

end_time

a number representing the number of hours after start_time or an datetime object (of class POSIXct) when the event ends. By default set to 1, meaning 1 hour after start_time.

format

required if start_time and end_time are vectors and are not of datetime format "%Y-%m-%d %H:%M", you can use calendar::formats object for convenience.

summary

short outline of the event

more_properties

add placeholder columns for properties in addition to properties_core, dy default FALSE

event_properties

named vector of additional properties to include. By default These include names stored in the data object properties (a packaged dataset), containing NAs to be subsequently populated.

Format

in case of start_time and end_time being character values, a format must be provided.

Value

object of class ics

Examples

ic_event()
s <- lubridate::ymd_h("2019-01-01 00")
ic_event(start_time = s, end_time = 3)
# also accepts this format by default, thanks to lubridate::ymd_h:
ic_event(start_time = "2019-01-01 00")
ic_event(more_properties = TRUE)
ic_event(start_time = "18-10-12", end_time = "18-10-13", format = calendar::formats$`yy-mm-dd`)

calendar documentation built on May 29, 2024, 2:34 a.m.