class: center, middle, inverse, title-slide .title[ # Communication and Application in Data Science with R ] .author[ ### Yi-Ju Tseng ] .date[ ### 2023-01-15 ] --- # After R? - Scheduling - Send Email - Create Dashboard --- class: inverse, center, middle # Scheduling --- # When You Need Scheduling? When you need to execute the code every x hours --- # Example from HW 2 [Download](https://github.com/CGUIM-BigDataAnalysis/BigDataCGUIM/blob/master/EMBA_BigData/pttJob.R) the sample code --- # Scheduling in R? - install **taskscheduleR** package (Windows) ```r install.packages("taskscheduleR") ``` - install **cronR** package (MacOS and Linux) ```r install.packages("cronR") ``` - You may also need **shinyFiles** package with MacOS ```r install.packages("shinyFiles") ``` --- # Tools -> Addins <img src="https://github.com/CGUIM-BigDataAnalysis/BigDataCGUIM/raw/master/EMBA_BigData/figures/addins.png" height="500px" style="display: block; margin: auto;" /> --- # Tools -> Addins -> cronR or taskscheduleR <img src="https://github.com/CGUIM-BigDataAnalysis/BigDataCGUIM/raw/master/EMBA_BigData/figures/cron_request.png" height="500px" style="display: block; margin: auto;" /> --- # Schedule Your .R file <img src="https://github.com/CGUIM-BigDataAnalysis/BigDataCGUIM/raw/master/EMBA_BigData/figures/pttJob.png" height="500px" style="display: block; margin: auto;" /> --- class: inverse, center, middle # Send Email --- # Send Email in R? - install **blastula** package [website](https://rstudio.github.io/blastula/) ```r install.packages("blastula") ``` --- # HTML email model <img src="https://rstudio.github.io/blastula/articles/images/html_email_model.png" height="500px" style="display: block; margin: auto;" /> [source](https://rstudio.github.io/blastula/articles/blastula.html) --- # Other Packages for HTML email - install **glue** package ```r install.packages("glue") ``` - install **kableExtra** package ```r install.packages("kableExtra") ``` - install **keyring** package ```r install.packages("keyring") ``` --- # Example from HW 2 [Download](https://github.com/CGUIM-BigDataAnalysis/BigDataCGUIM/blob/master/EMBA_BigData/pttJobEmail.R) the sample code --- # App Password for Gmail [Requirement for Using Gmail](https://rstudio.github.io/blastula/articles/sending_using_smtp.html) <img src="https://github.com/CGUIM-BigDataAnalysis/BigDataCGUIM/raw/master/EMBA_BigData/figures/app_pass.png" style="display: block; margin: auto;" /> --- # Email Message Was Sent <img src="https://github.com/CGUIM-BigDataAnalysis/BigDataCGUIM/raw/master/EMBA_BigData/figures/email_sent.png" style="display: block; margin: auto;" /> --- # Email Example <img src="https://github.com/CGUIM-BigDataAnalysis/BigDataCGUIM/raw/master/EMBA_BigData/figures/email_example.png" height="500px" style="display: block; margin: auto;" /> --- class: inverse, center, middle # Create Dashboard --- # Static Solution - install **flexdashboard** package [website](https://pkgs.rstudio.com/flexdashboard/index.html) ```r install.packages("flexdashboard") ``` --- # flexdashboard New RMarkdown with flexdashboard template -> **Knit** <img src="https://pkgs.rstudio.com/flexdashboard/reference/figures/NewRMarkdown.png" height="400px" style="display: block; margin: auto;" /> [source](https://pkgs.rstudio.com/flexdashboard/index.html) --- # Example from HW 2 [Download](https://github.com/CGUIM-BigDataAnalysis/BigDataCGUIM/blob/master/EMBA_BigData/flex_dash_ex.Rmd) the sample code and **Knit** --- # Simple Dashboard <img src="https://github.com/CGUIM-BigDataAnalysis/BigDataCGUIM/raw/master/EMBA_BigData/figures/flex_dash.png" height="500px" style="display: block; margin: auto;" /> --- # Cloud Solution - [Power BI](https://powerbi.microsoft.com/zh-tw/) - Cloud version: Use your O365 account - [Power BI Desktop](https://powerbi.microsoft.com/zh-tw/desktop/) (Windows only) - [使用 R 建立 Power BI 視覺效果](https://docs.microsoft.com/zh-tw/power-bi/create-reports/desktop-r-visuals) - [Tableau](https://www.tableau.com/zh-tw) - [Free for Student](https://www.tableau.com/zh-tw/academic/students) --- # Dynamic Solution TBD - install **shinydashboard** package [website](https://rstudio.github.io/shinydashboard/index.html) ```r install.packages("shinydashboard") ```