An Introduction to the Power and Potential of R

WiSER R Workshop

Overview

  1. Introduction to WiSER
  2. What is R?
  3. What is a Programming Language?
  4. Excel vs. R
  5. Why should you learn R?
  6. Guest speaker: Kathryn Lambert
  7. Guest speaker: Alex Harland
  8. Q&A (5-10 min)
  9. R Basics Demo (1 hour)

Before We Get Started…

Poll Question #1: Are you a graduate student, early career professional, or other?

Poll Question #2: Do you work with data?

What is R?

R is a programming language that is specialized in statistical computing and analysis. This makes R popular in disciplines and fields such as: biostatistics, bioinformatics, finance, research, public health, epidemiology, and data science.

What is RStudio?

What is a Programming Language?

A programming language is a vocabulary and set of grammatical rules for instructing a computer or computing device to perform a specific task.

Point-&-Click Interface

vs.

Programming Language

Why Should You Learn R?

Pros

  • Free and open source
  • OS independent (works with Windows, Linux, and Mac)
  • Flexibility and customization
  • Strong and growing user base and support community
  • Becoming more and more the standard for statistics

Cons

  • Not as versatile as other languages
  • Niche use
  • Works with data in memory
  • Steep learning curve

Why Should You Learn R?

Visually Appealing and Publication-Ready Figures and Tables!

Why Should You Learn R?

Visually Appealing and Publication-Ready Figures and Tables!

# Load packages
library(tidyverse)
library(yarrr)
library(plotly)

plot <- ggplot(data = pirates) + # existing data set in R
  
  # Define space:
  aes(x = height, y = weight) + 
  
  # Add points:
  geom_point(aes(color = sex, shape = sex)) + 
  
  # Change colours:
  scale_color_manual(values = c("male" = "green", "female" = "blue", "other" = "red")) + 
  
  # Add trend line:
  geom_smooth(method = lm, colour = "black", fill = "white") + 
  
  # Annotate with text:
  annotate("text", x = 188, y = 55, label = "R=0.93") + 
  
  # x-axis title:
  xlab("Height (cm)") + 
  
  # y-axis title:
  ylab("Weight (kg)") + 
  
  # Main title:
  ggtitle("Correlation Between Pirates' Weight and Height") + 
  
  # Clean background:
  theme_minimal() 

# Make the graph interactive:
ggplotly(plot)

Why Should You Learn R?

Automation!

  • Repetitive tasks
  • Reports and presentations (like this one!)
---
title: "An Introduction to the Power and Potential of R"
author: WiSER R Workshop
format: 
  revealjs:
    transition: slide
    title-slide-attributes: 
      data-background-image: background-title1.png  
editor: visual
---

Why Should You Learn R?

Create R Shiny Applications (or Dashboards)

Start Your R Learning Journey Today!

Image from PHAC’s Training and Development Unit.

Guest Speaker Introduction: Kathryn Lambert

Guest Speaker Introduction: Alex Harland

R Basics Demo!

Resources