Featured image of post CalendaR

CalendaR

No limits to the integration availables in RStudio

Are you trying to integrate a calendar into your R project?

Well, as you surely found out, R has a solution for everything. Moreover you won’t have to worry about advanced coding in HTML,CSS or JavaScript, you will only need basic knowledge of R.

In this post I will show an example of how to create an interactive calendar with R.

What is the perfect day?

Stop laying all the day watching Netflix, is it important to fulfill the day with activities. I am not saying you must work all day, but take your time also to integrate what makes you good.

Here is an example of a day:


20  Sat
All Day
0 am
1 am
2 am
3 am
4 am
5 am
6 am
7 am
8 am
9 am
10 am
11 am
12 pm
1 pm
2 pm
3 pm
4 pm
5 pm
6 pm
7 pm
8 pm
9 pm
10 pm
11 pm
Wake Up
Drink Water
Have a large breakfast
Workout
Get Ready
Machine Learning Lesson
Exam
Differential Calculus
Library
Group Project
Data Visualization
Add a post to the blog
Present the report
Spritz with the friends

This great visualization tool for render an interactive calendar is provided by the package toastui.

This package among providing this great calendar, is used to build grid and chart. Basically it traduces in R the implementation of Toast UI, a JavaScript UI library (free open source).

Here’s an example of an empty month calendar:


Sun
Mon
Tue
Wed
Thu
Fri
Sat
30
31
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
1
2
3
4
5
6
7
8
9
10
11
12

Setting yours it’s really simple. As you can see from the code below is pretty intuitive:

#remotes::install_github("dreamRs/toastui")
library(toastui)
toastui::calendar(    #initiate calendar
    view = "month") %>% #week or day
 cal_schedules(       #add a schedule
      title = "Spritz with the friends", 
    start = "2021-11-20 19:30:00",
    end = "2021-11-20 20:30:00",
    color = "#760C05",   #font-color
    bgColor = "#E16036", #background-color
    borderColor = "#E16036" 
    )