-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrender_corona.R
43 lines (37 loc) · 1.57 KB
/
render_corona.R
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
library(rmarkdown)
library(mailR)
# required to get pandoc to work properly when using Windows to schedule
# https://beta.rstudioconnect.com/content/3132/Job_Scheduling_R_Markdown_Reports_via_R.html
Sys.setenv(RSTUDIO_PANDOC="C:/Program Files/RStudio/bin/pandoc")
# Clean up old file if it exists
# Assign filename
fn <- "coronavirus.html"
if (file.exists(fn)) {
file.remove(fn)
}
# Render a single format, weekly report to email myself
render("coronavirus.Rmd", "html_document")
# If the above worked, email to myself
# if (TRUE %in% (list.files() == fn)) {
# # Send email to myself with plots attached.
# print("email")
# send.mail(from = "<[email protected]>",
# to = c("<[email protected]>"),
# bcc = c("<[email protected]>",
# "<[email protected]>",
# "<[email protected]>",
# "<[email protected]>",
# "<[email protected]>",
# "<[email protected]>",
# "<[email protected]>"),
# # "<[email protected]>"),
# subject = "Coronavirus Snapshot",
# body = "Weekly Coronavirus Snapshot, send return email if you want to opt out!",
# smtp = list(host.name = "smtp.mail.yahoo.com", ssl = TRUE,
# user.name = "grantchalmers",
# passwd = "cachebyter998"),
# authenticate = TRUE,
# send = TRUE,
# attach.files = fn,
# debug = TRUE)
# }