Skip to contents

This function creates an ical file based on a data frame with mixed events. Export as .ics file using `calendar::ic_write()`.

Usage

write_ical(
  df,
  date = "date",
  date.end = NA,
  title = "title",
  time.start = "start",
  time.end = "end",
  place = NA,
  place.def = NA,
  time.def = "10:00:00",
  time.dur = 60,
  descr = NA,
  link = NA,
  t.zone = "CET"
)

Arguments

df

A data frame with the calendar data

date

The name of the event date column in the data frame

date.end

The name of the end date column in the data frame

title

The name of the title column in the data frame

time.start

The name of the start time column in the data frame

time.end

The name of the end time column in the data frame

place

The name of the place column in the data frame

place.def

Default location to use when place is NA

time.def

Default start time to use when time.start is NA

time.dur

Default duration of the event in minutes, if time.end is NA

descr

Name of description/notes column if any.

Name of link column, if any.

t.zone

A character string of time zone for events. The string must be a time zone that is recognized by the user's OS.

Value

ical object

See also

[calendar package](https://github.com/ATFutures/calendar/) [icalendar standard webpage](https://icalendar.org)

Examples

df <- data.frame(
  date = c("2020-02-10", "2020-02-11"),
  date.end = c("2020-02-13",NA),
  title = c("Conference", "Lunch"),
  start = c("12:00:00", NA),
  time.end = c("13:00:00", NA),
  note = c("Hi there","Remember to come"),
  link = c("https://icalendar.org","https://agdamsbo.github.io/stRoke/")
)

write_ical(
  df,
  date = "date",
  date.end = "date.end",
  title = "title",
  time.start = "start",
  time.end = "time.end",
  place.def = "Conference Room",
  descr = "note",
  link = "link"
)
#> # A tibble: 2 × 7
#>   SUMMARY    DTSTART             DTEND               UID          LOCATION URL  
#>   <chr>      <dttm>              <dttm>              <chr>        <chr>    <chr>
#> 1 Conference 2020-02-10 12:00:00 2020-02-13 13:00:00 ical-706b72… Confere… http…
#> 2 Lunch      2020-02-11 10:00:00 2020-02-11 11:00:00 ical-0b7a8a… Confere… http…
#> # ℹ 1 more variable: DESCRIPTION <chr>