Create Desktop Notifications From R

Create Desktop Notifications From R

In a recent tweet: Create Desktop Notifications from R to improve your Data Science Productivity. I read about notifier package, it can create destop notifications from R.

Installation

R
1
devtools::install_github("gaborcsardi/notifier")

Usage

R
1
2
3
4
5
library(notifier)
notify(
title = "Warning",
msg = c("Hello World!")
)

We can also create a complex example:

R
1
2
3
4
5
6
7
notify(
title = "世界时钟",
msg = c(paste0(" 北京 - ", format(Sys.time(), format = "%H:%M:%S" ,tz = "Asia/Shanghai"),"\n",
paste0("印度 - ", format(Sys.time(), format = "%H:%M:%S" ,tz = "Asia/Calcutta"),"\n",
paste0("新加坡 - ", format(Sys.time(), format = "%H:%M:%S" ,tz = "Asia/Singapore"),"\n"))
)
))

Today’s quotation!

R
1
2
3
4
5
6
# devtools::install_github('amrrs/randquotes')
library(randquotes)
notify(
title = "Quote of the Day",
msg = c(randquote_simple())
)

If your current window is not RStudio or R, this notification can pop up:

A Chinese version?

R
1
2
3
4
5
6
7
# remotes::install_github('pzhaonet/sinx', build = TRUE, build_opts = c("--no-resave-data", "--no-manual"))
library(sinx)
(sinx <- sinx())
notify(
title = "今日语录",
msg = paste0(sinx$quote, "\n--", sinx$author, "\n", sinx$date)
)

The function of this package is obvious. If your R program takes a long time, you often hide RStudio for other work temporarily. In order to know in time when the R program runs out. you can set a reminder at the end of the program, or where the program may run incorrectly.

# R

Comments

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×