Analyzing Patient Data


Figure 1

Variables as Tags

Figure 2

Variables as Tags

Figure 3

Reassigning Variables

Figure 4

Creating Another Variable

Figure 5

Updating a Variable

Figure 6

Assigning Variables

Figure 7

Assigning Variables

Figure 8

Operations Across Margins

Figure 9

Scatter plot of average inflammation versus time demonstrating the result of using the plot function
Scatter plot of average inflammation versus time demonstrating the result of using the plot function

Figure 10

Scatter plot of maximum inflammation versus time demonstrating the result of using the plot function
Scatter plot of maximum inflammation versus time demonstrating the result of using the plot function

Figure 11

Scatter plot of minimum inflammation versus time demonstrating the result of using the plot function
Scatter plot of minimum inflammation versus time demonstrating the result of using the plot function

Creating Functions


Figure 1

A screenshot of the function `fahrenheit_to_celsius` defined above with some extra text annotations on specific function elements. Above the text `fahrenheit_to_celsisus`, the text reads 'Function name'. Above the text `temp_F`, the text reads 'Function argument(s)'.' The next two lines, surrounded by curly braces, are labelled 'Function body'.
Vocabulary associated with functions.

Analyzing Multiple Data Sets


Figure 1

Scatterplot of average daily inflammation over 40 days, increasing in a mostly straight line until day 20, and then decreasing in a mostly straight line to visualize inflammation levels in a single dataset.A scatterplot of maximum daily inflammation over 40 days, increasing in a straight line until day 20, and then decreasing in a straight line to visualize inflammation levels in a single dataset.A scatterplot of minimum daily inflammation over 40 days, increasing in a step-wise pattern until day 20, and then decreasing in a step-wise pattern to visualize inflammation levels in a single dataset.


Figure 2

A scatterplot of average daily inflammation over 40 days, increasing in a mostly straight line until day 20, and then decreasing in a mostly straight line to visualize inflammation levels in a single dataset.A scatterplot of average daily inflammation over 40 days, increasing in a mostly straight line until day 20, and then decreasing in a mostly straight line to visualize inflammation levels in a single dataset.A scatterplot of average daily inflammation over 40 days, increasing in a mostly straight line until day 20, and then decreasing in a mostly straight line to visualize inflammation levels in a single dataset.


Figure 3

Scatterplot of average daily inflammation showing a ramp with a peak at 20 days.Scatterplot of average daily inflammation showing a ramp with a peak at 20 days.Scatterplot of average daily inflammation showing a ramp with a peak at 20 days.


Figure 4

Scatterplot of average daily inflammation showing a ramp with a peak at 20 days.Scatterplot of average daily inflammation showing a ramp with a peak at 20 days.Scatterplot of average daily inflammation showing a ramp with a peak at 20 days.


Figure 5

Scatterplot of average daily inflammation showing a ramp with a peak at 20 days.Scatterplot of average daily inflammation showing a ramp with a peak at 20 days.Scatterplot of average daily inflammation showing a ramp with a peak at 20 days.


Making Choices


Figure 1

Executing a Conditional

Figure 2


Figure 3


Figure 4

A grey unlabeled boxplot chart showing the distrubution values between 2 and 9 with a mean at 6.

Figure 5

A grey unlabeled histogram showing bimodal distribution between 2 and 9 with peaks at 2 and 6.

Figure 6

A mostly blank strip chart showing five points at 3, 4, 6, 7, and 9

Figure 7


Command-Line Programs


Best Practices for Writing R Code


Dynamic Reports with knitr


Making Packages in R


Figure 1

tempConvert directory containing 4 items: Namespace file, Description file, man directory with documentation in .Rd files, R directory with functions in .R files

Introduction to RStudio


Addressing Data


Figure 1


Figure 2

2. In addition to dat$Group != 'Control', one could use dat$Group %in% c("Treatment1", "Treatment2").


Reading and Writing CSV Files


Understanding Factors


Figure 1

Bar chart showing control and treatment to emphasise how the function table() tabulates observations.

Figure 2

Bar chart showing control and treatment to emphasise how the function factor() moves the control group to the last coulumn.

Figure 3

Bar chart showing gender values in the dataset have been coded incorrectly.

Figure 4

Barplot graph showing blood pressure in males and females.

Figure 5


Figure 6


Data Types and Structures


The Call Stack


Figure 1

Call Stack (Initial State)

Figure 2

Call Stack Immediately After First Function Call

Figure 3

Call Stack During First Nested Function Call

Figure 4

Call Stack After Return From First Nested Function Call

Figure 5

Call Stack During Call to Second Nested Function

Figure 6

Call Stack After Second Nested Function Returns

Figure 7

Call Stack After All Functions Have Finished

Loops in R