[This article was first published on R-english – Freakonometrics, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)


Want to share your content on R-bloggers? click here if you have a blog, or here if you don’t.

In a few days, we will have our annual NSERC-CRSNG meeting for grant reviews. In a nutshell (the process will be the same as last year), we get an excel file that looks like a calendar, with about 45 slots of 20 minutes, from Monday 8 am till Friday 5 pm. This year, I wanted to create automatically notifications that could get directly into my agenda. And actually, that’s easy with calendar.

First, we can extract information for an excel file, or from a pdf document (which is a printed version of an excel file). First let us read the excel document

library("readxl")
loc = "/Users/ac/Downloads/NSERC.xlsx"
data_xls = read_excel(loc)

Then, I use the structure of the document: each column is a day, so I start on Monday, and then I go down, row by row. Each time I have something which looks like “RGPIN-2024-12345”, I create an ics file, with the reference name, and the appropriate time

library(stringr)
library(calendar)
library(lubridate)
ext_RGPIN = function(chr) str_extract_all(chr, "RGPIN-2024-[0-9]{4}|R[0-9]{1}")[[1]]
ext_time = function(chr)strsplit(as.character(chr)," - ")[[1]][1]
for(j in 2:6){
for(i in 1:nrow(data_xls)){
read_RGPIN = ext_RGPIN(data_xls[i,j])
if(!is.na(read_RGPIN[1])) {
dayhour = paste("2025-02-0",j," ",ext_time(data_xls[i,1]),sep="")
s <- lubridate::ymd_hm(dayhour,tz = "EST")
ic = ic_event(
start = s,
end = s+20*60 ,
summary = paste(read_RGPIN[1]," (",read_RGPIN[2],")",sep=""),
format = "%Y-%m-%d %H:%M")
ic_write(ic, paste("ic_NSERC",read_RGPIN[1],".ics",sep=""))
cat(read_RGPIN[1],"...",dayhour,"n")
}}}

(to illustrate, I imported those in 2025). Finally, I can import all those notifications in my agenda.

To leave a comment for the author, please follow the link and comment on their blog: R-english – Freakonometrics.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you’re looking to post or find an R/data-science job.


Want to share your content on R-bloggers? click here if you have a blog, or here if you don’t.

Continue reading: Creating automatically dozens of calendar notifications (with R)

Analysis of the Automated Creation of Calendar Notifications with R

In the recent NSERC-CRSNG meeting for grant reviews, the technique of creating automatic calendar notifications using R was showcased. The method involves extracting data from an Excel or PDF file, in which each column represents a day, and the process runs from top to bottom. An automatic notification is generated each time a particular pattern occurs, in this case, “RGPIN-2024-12345”. The method developed utilizes several packages in R, including readxl, stringr, calendar, and lubridate.

Long-term Implications

The ability to automate calendar notifications with this level of precision paves the way for more efficient project management and scheduling in various sectors. This R-driven method can streamline the administrative processes within academic institutions, corporations, and organizations by reducing human error and saving time and resources. In a long-term perspective, this could significantly enhance productivity.

Possible Future Developments

This current method primarily focuses on meetings with unique pattern identifiers. As a future development, this automation could be expanded and optimized to include other types of events without such identifiers; it could also incorporate meeting or event descriptions, location data, and participant information. This would make this tool even more versatile and comprehensive. Furthermore, future developments might also offer integration with popular calendar applications such as Google Calendar or Microsoft Outlook for more comfortable usage.

Actionable Advice

If your organization regularly handles large-scale meeting schedules or event calendars, considering the adoption of this R-based solution may prove beneficial. Here are a few pieces of advice to get started:

  1. Explore R and its packages: Familiarize yourself with the programming language R and its packages for data manipulation and calendar-related operations.
  2. Customize to Suit Your Needs: Modify the provided code to customize the pattern identifier matching your meeting or event nomenclature, so that it appropriately detects your meetings or events.
  3. Ensure File Accuracy: Make sure that your source files (Excel or PDF) are well-structured, with each column representing a different day and each slot representing the meetings rostered for that day.
  4. Integrate with Your Preferred Calendar: Enjoy the flexibility of this method by choosing to import these notifications into your preferred digital calendar.

Implementing this automated notification generation approach requires initial groundwork in understanding R and setting up the system. However, it promises to pay rich dividends in resource-saving and productivity enhancement in the longer run.

Read the original article