{:.no_toc}
R Training Workshops for HJF Global Infectious Diseases - Given in Aug and Sept 2023
Workshop Instructor:
- Melinda Higgins, PhD
- Director Biostatistics and Data Core
- Office of Nursing Research
- School of Nursing - Emory University
- [email protected]
Table of Contents
- TOC 1 {:toc}
- Download and install R
- Download and install RStudio Desktop
- optional read - Ch1 Getting Started with R/RStudio in "ModernDive" Book
- Instructions for installing R packages - we will cover package installation during the workshop.
-
R Packages for Workshops 1 & 2
arsenal
broom
ggthemes
(optional)ggthemr
(optional)- This package is NOT on CRAN and is installed from Github. You will need the
devtools
package to run thedevtools::install_github('Mikata-Project/ggthemr')
command.
- This package is NOT on CRAN and is installed from Github. You will need the
gmodels
gtsummary
Hmisc
knitr
patchwork
palmerpenguins
plyr
psych
rmarkdown
tidyverse
[includesdplyr
,ggplot2
,tidyr
,readr
, and more...]tinytex
& run the installation - see instructions at https://yihui.org/tinytex/usmap
-
R Packages for Workshop 3
- TBA
-
R Packages for Workshop 4
- TBA
Times | Materials Covered |
---|---|
08:30-09:45 | Part 1 - Intro to R and RStudio |
- module01_Rscript.R - right click "save as" | |
Part 2 - Working with R Packages | |
09:45-10:00 | Break |
10:00-11:15 | Part 3 - Intro to Visualizations with ggplot2 |
- ggplot_Rscript_01.R | |
- ggplot_Rscript_02.R | |
Part 4 - Intro to Rmarkdown [if time - see materials below] | |
11:15-11:30 | Q&A |
- [If Time] Part 4: The Utility of Rmarkdown - Report and Slides all from 1 file!
- Learn more about the Abalone dataset - freely available from the "UC Irvine Machine Learning Repository", see https://archive.ics.uci.edu/ml/datasets/abalone
- Files:
Times | Materials Covered |
---|---|
08:30-09:45 | Part 5 - Data Wrangling with dplyr |
- UPDATED dplyr_Rscript.R | |
- UPDATED dplyr_Rscript_wAnswers.R | |
Part 6 - Clean and Explore Abalones - R Script | |
- Part 6 R Script Answers | |
- abalone_clean.RData | |
- abalone_table.Rmd | |
- abalone_table.html | |
09:45-10:00 | Break |
10:00-11:15 | Part 7 - Merging Data |
- module07_Rscript.R | |
- data1.csv | |
- data2.csv | |
- data3.csv | |
Part 8 - Data Restructuring | |
- module08_Rscript.R | |
- long1.csv | |
- wide1.csv | |
Part 9 - If Time Simple Maps - R script | |
- Dataset hospital_ops.csv | |
- Map Report Simple RMD HTML | |
- Map Report w/Parameters RMD HTML | |
- Map Report w/choice RMD HTML | |
11:15-11:30 | Q&A |
A question was asked about what happens if a data file has text blocks with commas or carriage returns that might cause a problem reading in a delimited file format.
Here is a quick example to illustrate that it does work.
Example Data in CSV and EXCEL formats:
Example R Code to read these files:
See this document illustrating this textwrap example.
Additional R packages to be used today:
Times | Materials Covered |
---|---|
08:30-09:45 | review workshops 1, 2 and textwrap question |
Quick Overview of R Objects | |
R Program - Clean Abalone Data | |
R Program - Performing Statistical Tests | |
09:45-10:00 | Break |
10:00-11:15 | Working with Rmarkdown |
Regression - linear and logistic | |
AbaloneReport_Sept2023.Rmd | |
AbaloneReport_Sept2023.html | |
AbaloneReport_Sept2023.pdf | |
11:15-11:30 | Q&A |
Additional packages for today:
Times | Materials Covered |
---|---|
08:30-09:45 | missingData.R R Script |
09:45-10:00 | Break |
10:00-11:15 | More with Rmarkdown |
Part 9 - If Time Simple Maps - R script | |
- Dataset hospital_ops.csv | |
- Map Report Simple RMD HTML | |
- Map Report w/Parameters RMD HTML | |
- Map Report w/choice RMD HTML | |
11:15-11:30 | Open Discussion and Q&A |
Useful reference on missing data:
- Rmarkdown by RStudio
- R Markdown: The Definitive Guide
- R Markdown Cookbook
- Yihui Xie's knitr site
- Example Blog http://jenrichmond.rbind.io/post/2021-08-31-parameterised-penguins/
- Example Document https://rpubs.com/jenrichmond/adelie
- RStudio Education
- Quick-R
- BOOK: R in Action, 3rd ed.
- Datacamp
- Coursera
- My Emory Courses:
- BOOK: Statistical Inference via Data Science
- BOOK: The Epidemiologist R Handbook
- BOOK: R Graphics Cookbook, 2nd edition by Winston Chang
- R Graphics Cookbook website also by Winston Chang
- The R Graph Gallery