Nothing
knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(toastui)
Create interactive calendars with:
calendar()
You can display calendars in interactive R Markdown documents or Shiny applications:
Create a monthly calendar:
cal_demo_data()
return a data.frame
with schedules exampleuseNavigation = TRUE
: add navigation buttons to change the month displayedcal_month_options()
: global options for calendarcal_props()
: set properties for schedules groups (background and text color ...)calendar(cal_demo_data(), navigation = TRUE, defaultDate = Sys.Date()) %>% cal_month_options( startDayOfWeek = 1, narrowWeekend = TRUE ) %>% cal_props(cal_demo_props())
Create a weekly calendar:
cal_demo_data("week")
return a data.frame
with schedules example for weekview = "week"
: activate week view for calendardefaultDate = Sys.Date()
: force calendar to show the specified date (otherwise it shows the current date)cal_week_options()
: global options for calendarcal_props()
: set properties for schedules groups (background and text color ...)calendar(cal_demo_data("week"), view = "week", defaultDate = Sys.Date()) %>% cal_week_options( startDayOfWeek = 1, workweek = TRUE ) %>% cal_props(cal_demo_props())
To add schedules into a calendar who can pass a data.frame
as first argument to calendar()
, or use cal_schedules()
:
# Define directly schedules properties calendar() %>% cal_schedules( title = "My schedule", start = format(Sys.Date(), "%Y-%m-03 00:00:00"), end = format(Sys.Date(), "%Y-%m-17 00:00:00") ) # Or you can use a data.frame my_calendar_data <- data.frame( title = "My schedule", start = format(Sys.Date(), "%Y-%m-03 00:00:00"), end = format(Sys.Date(), "%Y-%m-17 00:00:00") ) calendar() %>% cal_schedules( my_calendar_data )
Properties for schedules are described in table below:
datagrid(schedules_properties) %>% grid_columns( column = "Name", width = 150, renderer = list( styles = list( fontWeight = "bold" ) ) ) %>% grid_columns( column = "Type", width = 150 )
Calendar properties can be used to set common appearance to a group of schedules with the same calendarId
.
calendar() %>% cal_schedules( title = "My schedule", calendarId = 123, # <-- set a calendarId start = format(Sys.Date(), "%Y-%m-03 00:00:00"), end = format(Sys.Date(), "%Y-%m-17 00:00:00") ) %>% cal_props( id = 123, # <-- reference to schedules' calendarId name = "My Calendar", color = "white", backgroundColor = "darkorange", borderColor = "darkorange" )
Properties for calendars are described in table below:
datagrid(calendar_properties, bodyHeight = "auto") %>% grid_columns( column = "Name", width = 150, renderer = list( styles = list( fontWeight = "bold" ) ) ) %>% grid_columns( column = "Type", width = 150 )
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.