Skip to contents

# Write ical object

Source: `R/write_ical.R`
`write_ical.Rd`

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.

link

  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 icalendar standard webpage

## 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-64f3f5… Confere… http…
    #> 2 Lunch      2020-02-11 10:00:00 2020-02-11 11:00:00 ical-e4354f… Confere… http…
    #> # ℹ 1 more variable: DESCRIPTION <chr>