RMRWR
1
Preface
1.1
Who This Book is For
1.2
Prerequisites
1.3
The (Upward) Spiral of Success Structure
1.4
Motivation for this Book
1.5
The Scientific Reproducibility Crisis
1.6
Features of a Bookdown electronic book
1.7
What this Book is Not
1.7.1
This Book is Not A Statistics Text
1.7.2
This Book Does Not Provide Comprehensive Coverage of the R Universe
1.8
Some Guideposts
1.9
Helpful Tools
1.9.1
Demonstrations in Flipbooks
1.9.2
Learnr Coding Exercises
1.9.3
Coding
2
Getting Started and Installing Your Tools
2.1
Goals for this Chapter
2.2
Website links needed for this Chapter
2.3
Pathway for this Chapter
2.4
Installing R on your Computer
2.5
Windows-Specific Steps for Installing R
2.5.1
Testing R on Windows
2.6
Mac-specific Installation of R
2.6.1
Testing R on the Mac
2.6.2
Successful testing!
2.7
Installing RStudio on your Computer
2.7.1
Windows Install of RStudio
2.7.2
Testing Windows RStudio
2.7.3
Installing RStudio on the Mac
2.7.4
Testing the Mac Installation of RStudio
2.7.5
Critical Setup - Tuning Up Your RStudio Installation
2.8
Installing Git on your Computer
2.8.1
Installing Git on macOS
2.8.2
Installing Git on Windows
2.8.3
Installing Git on Linux
2.9
Getting Acquainted with the RStudio IDE
3
A Tasting Menu of R
3.1
Setting the Table
3.2
Goals for this Chapter
3.3
Packages needed for this Chapter
3.4
Website links needed for this Chapter
3.5
Setting up RPubs
3.6
Open a New Rmarkdown document
3.7
Knitting your Rmarkdown document
3.7.1
Installing Packages
3.7.2
Loading Packages with library()
3.8
Your Turn to Write Text
3.9
Wrangle Your Data
3.10
Summarize Your Data
3.11
Visualize Your Data
3.12
Statistical Testing of Differences
3.13
Publish your work to RPubs
3.14
The Dessert Cart
3.14.1
Interactive Plots
3.14.2
Animated Graphics
3.14.3
A Clinical Trial Dashboard
3.14.4
A Shiny App
3.14.5
An Example of Synergy in the R Community
4
Introduction to Reproducibility
4.1
First Steps to Research Reproducibility
4.1.1
Have a Plan
4.1.2
Treat Your Raw Data Like Gold
4.1.3
Cleaning and Analyzing Your Data
4.1.4
The First Level of Reproducibility
4.1.5
The Second Level of Reproducibility
4.2
The Foundations of Reproducibility
5
Importing Your Data into R
5.1
Reading data with the {readr} package
5.1.1
Test yourself on scurvy
5.1.2
What is a path?
5.1.3
Try it Yourself
5.2
Reading Excel Files with readxl
5.2.1
Test yourself on read_excel()
5.3
Bringing in data from other Statistical Programs (SAS, Stata, SPSS) with the {haven} package
5.4
Other strange file types with rio
5.5
Data exploration with glimpse, str, and head/tail
5.5.1
Taking a glimpse with
glimpse()
5.5.2
Try this out yourself.
5.5.3
Test yourself on strep_tb
5.5.4
Examining Structure with
str()
5.5.5
Test yourself on the scurvy dataset
5.5.6
Examining a bit of data with
head()
and
tail()
5.5.7
Test yourself on the printing tibbles
5.6
More exploration with skimr and DataExplorer
5.6.1
Test yourself on the
skim()
results
5.6.2
Test yourself on the
create_report()
results
5.7
Practice loading data from multiple file types
5.8
Practice saving (writing to disk) data objects in formats including csv, rds, xls, xlsx and statistical program formats
5.9
How do readr and readxl parse columns?
5.10
What are the variable types?
5.11
Controlling Parsing
5.12
Chapter Challenges
5.13
Future forms of data ingestion
6
Wrangling Rows in R with Filter
6.1
Goals for this Chapter
6.2
Packages needed for this Chapter
6.3
Pathway for this Chapter
6.4
Logical Statements in R
6.5
Filtering on Numbers - Starting with A Flipbook
6.5.1
Your Turn - learnr exercises
6.6
Filtering on Multiple Criteria with Boolean Logic
6.6.1
Your Turn - learnr exercises
6.7
Filtering Strings
6.7.1
Your Turn - learnr exercises
6.8
Filtering Dates
6.8.1
Your Turn - learnr exercises
6.9
Filtering Out or Identifying Missing Data
6.9.1
Working with Missing data
6.9.2
Your Turn - learnr exercises
6.10
Filtering Out Duplicate observations
6.11
Slicing Data by Row
6.12
Randomly Sampling Your Rows
6.12.1
Your Turn - learnr exercises
6.13
Further Challenges
6.14
Explore More about Filtering
7
The Basics of R
7.1
Why Programming?
7.2
Programming Fears
7.3
Thinking about Wofkflow
7.4
Files in R
7.4.1
Data Files
7.4.2
Script files
7.4.3
Other files
7.5
Paths in R
7.6
Creating variables in R
7.7
The Pipe Operator
7.8
R Dialects
8
Wrangling Columns in R with Select, Rename, and Relocate
8.1
Goals for this Chapter
8.2
Packages needed for this Chapter
8.3
Pathway for this Chapter
8.4
Tidyselect Helpers in R
8.5
Selecting a Column Variables
8.5.1
Try this out
8.6
Selecting Columns that are Not Contiguous
8.7
Selecting Columns With Logical Operators
8.8
Further Challenges
8.9
Explore More about Filtering
9
Using Mutate to Make New Variables (Columns)
9.1
Calculating BMI
9.2
Recoding categorical or ordinal data
9.3
Calculating Glomerular Filtration Rate
10
Mutating Joins to Combine Data Sources
10.1
What are Joins?
10.2
What are Mutating Joins?
10.3
Let’s Start with Left Joins
10.4
Left Join in Action
10.5
Left Join in Practice
10.6
Quick Quiz
10.7
Problem variable names
10.8
Right Join in Action
10.9
Right Join in Practice
10.10
Inner Joins
10.11
Quick Quiz
10.12
Now Let’s take a Look at the result
10.13
Full Joins
10.14
Quick Quiz
10.15
Now Let’s take a Look at the result
11
Interpreting Error Messages
11.1
The Common Errors Table
11.2
Examples of Common Errors and How to fix them
11.2.1
Missing Parenthesis
11.2.2
An Extra Parenthesis
11.2.3
Missing pipe
%>%
in a data wrangling pipeline
11.2.4
Missing + in a ggplot pipeline
11.2.5
Pipe
%>%
in Place of a
+
11.2.6
Missing Comma Within a Function()
11.2.7
A Missing Object
11.2.8
One Equals Sign When you Need Two
11.2.9
Non-numeric argument to a binary operator
11.3
Errors Beyond This List
11.4
When Things Get Weird
11.4.1
Restart your R Session (Shift-Cmd-F10)
11.5
References:
12
The Building Blocks of R: data types, data structures, functions, and packages
12.1
Data Types
12.2
Data Structures
12.3
Examining Data Types and Data Structures
12.4
Functions
12.5
Packages
12.6
The Building Blocks of R
13
Building Your Table One with the {gtsummary} Package
13.1
Using tbl_summary() from the gtsummary package
13.2
Making a Basic table
13.2.1
Challenges:
13.3
Multiple Dimensions
13.4
New Challenges
13.5
Even More Help
13.6
Figuring out Column names
13.7
Even More Challenges
13.8
Adding Some Formatting
13.8.1
Formatting with {gt}
13.9
A Fancier Version for gt
13.9.1
The {flextable} package
13.10
A Fancier Version for Flextable
14
Tips for Hashtag Debugging your Pipes and GGPlots
14.1
Debugging
14.2
The Quick Screen
14.3
Systematic Hunting For Bugs in Pipes
14.4
Systematic Hunting For Bugs in Plots
14.5
Hashtag Debugging
14.6
Pipe 2
14.7
Plot 2
14.8
Plot3
14.9
Pipe 3
15
Finding Help in R
15.1
Programming in R
15.2
Starting with Help!
15.3
The Magic of Vignettes
15.4
Googling the Error Message
15.5
You Know What You Want to Do, but Don’t Know What Package or Function to Use
15.5.1
CRAN Task Views
15.5.2
Google is Your Friend
15.6
Seeking Advanced Help with a Minimal REPREX
16
The Basics of Base R
16.1
Dimensions of Data Rectangles
16.2
Naming columns
16.3
Concatenation
16.4
Sequences
16.5
Constants
16.6
Fancier Sequences
16.7
Mathematical functions
16.8
Handling missing data (NAs)
16.9
Cutting Continuous data into Levels
17
Updating R, RStudio, and Your Packages
17.1
Installing Packages
17.1.1
Installing Packages from Github
17.1.2
Problems with Installing Packages
17.2
Loading Packages with Library
17.3
Updating R
17.4
Updating RStudio
17.5
Updating Your Packages
18
Major R Updates (Where Are My Packages?)
18.1
When to Upgrade R
18.2
Preparing for a Minor or Major R Upgrade
18.2.1
Before you upgrade R
18.2.2
STEP 1: Clean up old, unused packages
18.2.3
STEP 2: Build a dataframe of your currently installed packages.
18.2.4
STEP 3: Removing unwanted Packages from the dataframe
18.2.5
STEP 4: Upgrading R to the new Version
18.2.6
STEP 5: Upgrading the RStudio Version
18.3
STEP 6: Rebuilding All of your Packages in One (Automated) Step
18.4
Checking the new library path
18.5
Now Check your list of Packages
18.6
Updating Packages
19
Intermediate Steps Toward Reproducibility
19.1
Level 3 Reproducibility
19.1.1
Creating a New Project in RStudio
19.1.2
File paths and the {here} package
19.2
Code Review with a Coding Partner
19.2.1
Checklist for Code Review
19.3
Sharing code on GitHub
20
Building Table One for a Clinical Study
20.1
Packages Needed for this Chapter:
20.2
Pathway for this Chapter
20.3
Baseline Characteristics
20.4
Building Your Table 1
20.4.1
Updating Variable Labels
20.4.2
Updating Variable Values
20.4.3
Table 1 separated by Treatment Arm
20.4.4
Styling our Table 1
20.4.5
Adding A Column Spanner
20.4.6
Further Styling our Table 1
20.4.7
Your Turn
20.5
Try this with a new dataset
20.6
Making Modifications to the trial table
20.7
More Modifications to the trial table
20.8
Taking Control of the Stats
20.8.1
Your Turn
21
Comparing Two Measures of Centrality
21.0.1
Applying the t test
22
Simple example of a t-test
22.1
Common Problem
22.1.1
How Skewed is Too Skewed?
22.1.2
Visualize the Distribution of data variables in ggplot
22.1.3
Visualize the Distribution of data$len in ggplot
22.1.4
Results of Shapiro-Wilk
22.1.5
Try it yourself
22.1.6
Mammal sleep hours
22.2
One Sample T test
22.2.1
How to do One Sample T test
22.2.2
Interpreting the One Sample T test
22.2.3
What are the arguments of the t.test function?
22.3
Insert flipbook for ttest here
22.3.1
Flipbook Time!
22.4
Fine, but what about 2 groups?
22.4.1
Setting up 2 group t test
22.4.2
Results of the 2 group t test
22.4.3
Interpreting the 2 group t test
22.4.4
2 group t test with wide data
22.4.5
Results of 2 group t test with wide data
22.5
3 Assumptions of Student’s t test
22.5.1
Testing Assumptions of Student’s t test
22.6
Getting results out of t.test
22.6.1
Getting results out of t.test
22.7
Reporting the results from t.test using inline code
22.7.1
For Next Time
23
Sample Size Calculations with
{pwr}
23.1
Sample Size for a Continuous Endpoint (t-test)
23.2
One Sample t-test for Lowering Creatinine
23.3
Paired t-tests (before vs after, or truly paired)
23.4
2 Sample t tests with Unequal Study Arm Sizes
23.5
Testing Multiple Options and Plotting Results
23.6
Your Turn
23.6.1
Scenario 1: FEV1 in COPD
23.6.2
Scenario 2: BNP in CHF
23.6.3
Scenario 3: Barthel Index in Stroke
23.7
Sample Sizes for Proportions
23.8
Sample size for two proportions, equal n
23.9
Sample size for two proportions, unequal arms
23.10
Your Turn
23.10.1
Scenario 1: Mortality on Renal Dialysis
23.10.2
Scenario 2: Intestinal anastomosis in Crohn’s disease
23.10.3
Scenario 3: Metformin in Donuts
23.11
add chi square
23.12
add correlation test
23.13
add anova
23.14
add linear model
23.15
add note on guessing effect sizes - cohen small, medium, large
23.16
Explore More
24
Randomization for Clinical Trials with R
24.1
Printing these on Cards
24.2
Now, try this yourself
24.3
Now Freestyle
25
Univariate ggplots to Visualize Distributions
25.1
Histograms
25.1.1
Comparisons of Distributions with Histograms
25.1.2
Histograms and Categories
25.2
Density Plots
25.2.1
Comparisons with Density plots
25.3
Comparing Distributions Across Categories
25.4
Boxplots
25.5
Violin Plots
25.6
Ridgeline Plots
25.6.1
Including Plots
25.6.2
Including Points
25.6.3
Including Points
25.6.4
Including Points
25.6.5
Including Points
26
Bivariate ggplot2 Scatterplots to Visualize Relationships Between Variables
26.1
Packages used in this Chapter
26.2
Data Exploration and Validation (DEV)
26.3
Scatterplots
26.3.1
Micro-quiz!
26.4
Mapping More Variables
26.5
Inheritance and Layering in ggplot2
26.6
Aesthetic mapping Micro-Quiz!
26.7
Controlling Point Shape, Size, and Color Manually
26.7.1
Manual Shapes
26.7.2
Manual Sizes
26.7.3
Manual Color
27
Extensions to ggplot
27.1
Goals for this Chapter
27.2
Packages Needed for this chapter
27.3
A Flipbook of Where We Are Going With ggplot Extensions
27.3.1
MAKE FLIPBOOK
27.4
A Waffle Plot
27.5
An Alluvial Plot
27.6
Lollipop Plots
27.7
Dumbbell Plots
27.8
Spaghetti Plots with Summary Smoothed Lines for Change Over Time
27.9
Swimmer Plots
27.10
Adding Significance Comparisons with {ggsignif}
28
Customizing Plot Scales
28.1
Goals for this Chapter
28.2
Packages Needed for this chapter
28.3
A Flipbook of Where We Are Going With Scales
28.4
A Basic Scatterplot
28.5
But what if you want the scale for risk to start at 0?
28.6
But this axis does not really start at Exactly 0
28.7
Control the Limits and the Breaks
28.8
Test what you have learned
28.9
Continuous vs. Discrete Plots and Scales
28.10
Using Scales to Customize a Legend
28.11
Test what you have learned
28.11.1
More Examples with Flipbooks
29
Helping out with ggplot
29.1
ggx::gghelp()
29.2
Getting more help with theming with ggThemeAssist
29.3
Website helpers for ggplot
29.4
Getting Even more help with esquisse
30
Mapping Health Data in R
30.1
The {tigris} package and Basic Mapping in R
30.2
Mapping with OpenStreetMap Data
30.3
Another Example
30.4
Mapping Population By County
30.5
Finding a Census Field
30.5.1
Mapping Commute Times
30.5.2
Mapping Work From Home
30.6
Mapping and Merging Health Data
30.6.1
Solution
30.7
Now to merge
30.8
Texas Health Data
30.8.1
Solution to ACS
30.8.2
Solution to Merge
30.8.3
Solution to Mapping
30.9
Mapping California
30.10
A bit of US geographic unit history
30.11
Merge problems
30.12
Instead of using names, match by GEOID (in us counties) = fips (health data)
30.13
Mapping Distances
30.14
We can narrow this down to a smaller Area, such as Philadelphia, and driving time to the Children’s Hospital of Philadelphia (CHOP).
30.15
Driving to UCLA Reagan Hospital
30.16
You can learn about other mapping packages, like
31
Resources for Learning More about {mapgl}
31.1
Resources for learning more about {tmap}:
31.2
Resources for learning more about {leaflet}:
31.3
Resources for learning more about {ggmap}:
32
Functions
32.1
Don’t repeat yourself
32.2
Your Turn
32.3
Freestyle
32.3.1
Acknowledgement
32.4
Read More
33
Using Found (Web) Data
33.1
Found Poetry
33.2
Found Data
33.3
Download Example
33.4
Datapasta (small table) Example
33.5
Your Turn
33.6
{rvest} Example
33.7
Your Turn
33.8
API example with {tidycensus}
33.9
Challenges
33.10
Advanced Challenge - Dynamic Websites
34
Linear Regression and Broom for Tidying Models
34.1
Packages needed
34.2
Building a simple base model with {lm}
34.2.1
Producing manuscript-quality tables with {gtsummary}
34.3
Is Your Model Valid?
34.4
Making Predictions with Your Model
34.4.1
Predictions from new data
34.5
Choosing predictors for multivariate modeling – testing, dealing with collinearity
34.5.1
Challenges
34.6
presenting model results with RMarkdown
34.6.1
Challenges
34.7
presenting model results with a Shiny App
34.7.1
Challenges
35
Logistic Regression and Broom for Tidying Models
35.1
The Model Summary
35.2
Evaluating your Model Assumptions
35.3
Converting between logit, odds ratios, and probability
36
Fast and Frugal Trees with the {FFTrees} Package
36.1
Setup
36.2
The Breast Cancer Dataset
36.2.1
Data Inspection
36.2.2
Check Your Progress
36.3
Building a FFTrees Model for Breast Cancer
36.4
Your Turn with Heart Disease Data
36.4.1
Test what you have learned
36.5
Your Turn to Build and Interpret a Model
36.6
Now build your FFTrees model to predict improved status (vs. death)
37
A Gentle Introduction to Shiny
37.1
What is Shiny?
37.2
The Basic Structure of a Shiny App
37.2.1
The weirdness of a Shiny app
37.3
The User Interface Section Structure
37.4
The Server Section Structure
37.5
How to Run an App
37.5.1
How to Stop an App
37.6
Building a Very Simple App (Version 1)
37.6.1
The ui section
37.6.2
The server section
37.7
Edit this App (Version 2)
37.8
Building a User Interface for Inputs and Outputs
37.8.1
Inputs
37.8.2
Outputs
37.9
Building a Functioning Server Section
37.9.1
Using the input values & Data
37.9.2
Wrangling and Calculating
37.9.3
Rendering to HTML Outputs
37.10
Building a Simple Shiny App (Version 3)
37.11
Publishing Your Shiny App on the Web
37.12
More to Explore
38
Sharing Models with Shiny
38.0.1
Packages Needed for this Chapter
38.1
Setting up and Saving Models
38.1.1
Linear Model
38.1.2
Logistic Model
38.1.3
Random Forest Model
38.2
Building a Shiny App for the Linear Model
38.2.1
The Default Shiny App
38.2.2
Editing the
ui
sidebarPanel
for the Input Predictor Variables
38.2.3
Editing the
server
section to make Predictions
38.2.4
Editing the mainPanel in the ui section to display your Prediction
38.3
Building a Shiny App for the Logistic Model
38.3.1
The Default Shiny App
38.3.2
Editing the
ui
sidebarPanel
for the Input Predictor Variables
38.3.3
Editing the
server
section to make Predictions
38.3.4
Editing the mainPanel in the ui section to display your Prediction
38.4
Building a Shiny App for the Random Forest Model
38.5
Challenge Yourself
39
Introduction to R Markdown
39.1
What Makes an Rmarkdown document?
39.2
Trying out RMarkdown with a Mock Manuscript
39.3
Inserting Code Chunks
39.3.1
Code Chunk Icons
39.4
Including Plots
39.5
Including Tables
39.6
Including Links and Images
39.6.1
Links
39.6.2
Images
39.7
Other languages in code chunks
39.8
Code Chunk Options
39.9
How It All (Rmarkdown + {knitr} + Pandoc) Works
39.10
Knitting and Editing (and re-Knitting() Your Rmd document
39.11
Try Out Other Chunk Options
39.12
The
setup
chunk
39.13
Markdown syntax
39.14
2nd Header
39.14.1
3rd Header
39.15
Line Breaks and Page Breaks
39.16
Making Lists
39.16.1
Ordered Lists
39.16.2
Un-ordered lists
39.16.3
Nested Lists
39.17
The Easy Button - Visual Markdown Editing
39.17.1
Try inserting a list, a table and a block-quote
39.18
Inline Code
39.18.1
Try inserting some in-line R code
39.19
A Quick Quiz
40
Rmarkdown Output Options
40.1
Microsoft Word Output from Rmarkdown
40.1.1
Making a Styles Reference File for Microsoft Word
40.1.2
Let’s Practice This.
40.1.3
Re-formatting Your Template
40.1.4
Using Your New Styles Template
40.1.5
Now you are ready!
40.2
PDF Output from RMarkdown
40.2.1
LaTeX and tinytex
40.2.2
Knitting to PDF
40.3
Microsoft Powerpoint Output from Rmarkdown
40.3.1
Tables in Powerpoint
40.3.2
Images in Powerpoint
40.3.3
Plots in Powerpoint
41
Adding Citations to your RMarkdown
42
Quarto is a Next-Generation RMarkdown
42.1
Goals for this Chapter
42.2
Packages Needed for this chapter
42.3
Introducing Quarto
42.4
A Tour of Quarto
42.5
Opening a New Quarto Document
42.6
Annotating code in Quarto
42.7
The Visual Editor vs. Source Editor in Quarto
42.8
Adding Code Chunks
42.9
Organized Options in Code Chunks with the Hash-Pipe #|
42.10
Stating Global Options in Your YAML Header
42.10.1
Code Options and Code Folding
42.10.2
Parameters
42.11
Figures
42.12
Tables
42.13
Inline Code and Caching
42.14
Quarto at the Command Line
42.15
Citations in Quarto
42.16
Challenge Yourself
42.17
Exploring further
43
Running R from the UNIX Command Line
43.1
What is the UNIX Command line?
43.2
Why run R from the command line?
43.3
How do you get started?
43.3.1
On a Mac
43.3.2
On a Windows PC
43.4
The Yawning Blackness of the Terminal Window
43.5
Where Are We?
43.6
Cleaning Up
43.7
Other helpful file commands
43.8
What about R?
43.9
What about just a few lines of R?
43.10
Running an R Script from the Terminal
43.11
Rendering an Rmarkdown file from the Terminal
44
Secure Passwords in R
44.1
Setting New Keys
45
Dates and Times in R
45.1
Data Types for Dates and Times
45.2
Using POSIXlt
45.3
Formatting dates
45.3.1
Code Chunk Icons
45.4
Including Plots
45.5
Including Tables
45.6
Other languages in code chunks
45.7
Code Chunk Options
45.8
Try Out Other Chunk Options
45.9
The
setup
chunk
45.10
The Easy Button - Visual Markdown Editing
45.11
A Quick Quiz
46
Protecting PHI (Protected Health Information)
46.1
Protecting (Not Inadvertently Sharing) PHI
46.2
Identifying PHI
46.3
Selectively Deleting PHI
46.4
Problems with PHI-free data
46.5
Encrypting PHI
46.5.1
Generating Public and Private keys
46.6
Sharing synthetic data with {synthpop}
47
Building Data Pipelines with {targets}
47.1
What Does {targets} Do?
47.2
Air Quality Analysis
47.2.1
Prepping The Functions.R file
47.2.2
Checking Your Functions
47.2.3
Set Up the Pipeline
47.2.4
Pre-Build Checks
47.2.5
Changing the Pipeline
47.3
Your Turn - A Tuberculosis Analysis Pipeline
47.3.1
Making new Functions
47.3.2
Testing functions
47.4
Resetting functions before the Pipeline is Built
47.4.1
Setting Up {targets}
47.5
Editing the
_targets.R
File
47.5.1
Running the Pipeline
47.5.2
Modificatons to the Pipeline
47.5.3
Modify the Plot
47.6
Next Steps
48
Colors and Scales in {ggplot2}
48.1
Goals for this Chapter
48.2
Colors in R and {ggplot2}
48.2.1
Using pre-defined color names
48.2.2
Using color hex codes
48.2.3
Screen vs. Print Colors
48.2.4
Transparency and hex colors
48.2.5
More obscure ways to select colors
48.2.6
Using color palettes
48.2.7
Color-blind friendly palettes
48.3
Sequential, Diverging, and Qualitative Palettes
48.4
Choosing Colors with Meaning
49
Using the {flowchart} package for CONSORT diagrams in R
49.1
Why Flowcharts?
49.2
Loading Libraries
49.3
A CONSORT Flowchart for Statins to Prevent HCC
49.4
Data
49.5
Branching
49.6
Splitting into Groups (Treatment Arms)
49.6.1
A Short Tangent on {ifelse}
49.7
Filtering for Completers
49.8
Modify exclusions for more detailed labels
49.8.1
Time for a Quiz
49.9
A More Complicated Study
49.10
Example
49.11
Branching
49.12
Splitting into Groups (Treatment Arms)
49.13
Filtering for Completers
49.14
Modify exclusions for more detailed labels
49.15
Next step
49.16
Now Add These Withdrawal Reasons
49.17
Your Turn
49.17.1
Fatigue Starting Box
49.17.2
Fatigue Branching fr=or Exclusions with fc_filter
49.17.3
Branching Fatigue
49.17.4
Fatigue Completers
49.17.5
Fatigue Text for Exclusions
49.17.6
Fatigue Add text for Exclusions
49.17.7
Withdrawal Reasons
49.17.8
Now add these to Your Flowchart with fc_modify
49.17.9
Final Fatigue Flowchart Drawing fatigue_fc6
49.17.10
Explore More Features
50
Using the {tabulapdf} package tp extract tables from PDFs
50.1
Why Tables from PDFs?
50.2
Extracting Tables from PDFs
50.3
Extracting Tables from PDFs
50.4
Extracting Tables from the PDF
50.5
Extracting a Specific Table
50.6
Extracting a Specific Table
50.7
Viewing and Targeting the PDF
50.8
Your Turn
50.8.1
Explore More Features
51
Using the {heemod} package to Evaluate Markov Models of Health Economic Strategies
51.1
Why Health Economic Evaluation and Markov Models?
51.2
Preparation for Modeling
51.3
Health States
51.4
Utilities
51.5
Transition Probabilities
51.6
Costs
51.6.1
Maintenance Health Care Costs
51.7
Cycle Time
51.8
Building Your Model and Calculating Outcomes
51.9
A First Model
51.10
The Transition State Matrix
51.11
Attach Values to States
51.12
Combining Transitions and Values into A Model
51.13
Run the Model
51.14
Your Turn
51.14.1
Explore More Features
51.14.2
Explore Health Economics Beyond {heemod}
52
Using your .Rprofile and .Renviron file and RStudio Code Snippets
52.1
Setting up your .Rprofile file
52.2
Setting up your .Renviron file
52.2.1
Explore REDCapTidieR and Quarto Dashboards
53
Using your .Rprofile and .Renviron file and RStudio Code Snippets
53.1
Setting up your .Rprofile file
53.2
Setting up your .Renviron file
53.2.1
Using RStudio Code Snippets
53.3
Code Folding and Sections in RStudio
53.3.1
Explore More
Title holder
References
Published with bookdown
Reproducible Medical Research with R
References