Hands-On Introduction to R

Course 1268

  • Duration: 3 days
  • Labs: Yes
  • Language: English
  • Level: Foundation

This introductory R programming course provides hands-on experience using R, a programming language for statistical computing, machine learning, and graphics. R is widely used in diverse disciplines to estimate, predict, and display results. Students will learn how to use R to clean, analyse, and graph data in this course.

Introduction to R Delivery Methods

  • In-Person

  • Online

Introduction to R Course Benefits

Perform computations in R

Load data sets from various sources into R

Transform data sets in preparation for analysis

Create tidy data using the Tidyverse packages

Visualize data with ggplot2

Fit models to data

Continue learning and face new challenges with after-course one-on-one instructor coaching

Prerequisites

  • Experience with another procedural or object-oriented programming language, such as C, C++, Java, VB .NET, or SQL
  • Familiarity with concepts, such as variables, loops, and branches with some experience using a text editor to edit program code

Exam Information

Optional Learning Tree exam available at the end of class

  • Introduction to S, S-PLUS, and R
  • Design of R
  • Advantages of R
  • Limitations of R
  • The R GUI
  • The R GUI

Hands-On Exercise 1.1

  • The RStudio Interface
  • The RStudio Interface
  • RStudio Demo
  • Setting Up a Custom CRAN Mirror
  • Changing RStudio Options
  • Naming Conventions, R Commands and Variables
  • Basic Data Types
  • Creating and Removing Variables
  • Numbers and Character Types
  • Functions and Packages
  • Common Mathematical Functions
  • Common Statistical Functions
  • Common Probability Functions
  • The tidyverse Family of Packages
  • Installing tidyverse
  • Character Processing Functions in the stringr Package
  • Complex Character Manipulation Functions
  • Complex Character Manipulation Functions II
  • Complex Character Manipulation Functions III
  • Miscellaneous Functions
  • The Pipe Operator
  • Pipe Operator Example
  • Performing Calculations
  • Executing Code in R Script File
  • Executing Code in R Script File

Hands-On Exercise 1.1

  • Introducing the Tidyverse
  • Data Input
  • Reading From a File
  • Reading and Displaying a File
  • Structure of the Data
  • Reading and Writing to Excel File
  • Reading From a Database Using the RODBC Package
  • Reading From a Database Using the dbplyr Package
  • Saving Data From R to Disk

Hands-On Exercise 1.2

  • Data Structures
  • Numeric Vectors
  • Vector Arithmetic
  • Vector Arithmetic
  • Generating Sequences
  • Repeating with the rep() function
  • Logical Vectors
  • Boolean Operations
  • Missing Values
  • Character Vectors
  • The paste() function
  • Selecting and Modifying Elements of a Vector
  • Selecting and Modifying Elements of a Vector
  • Selecting and Modifying Elements of a Vector
  • Getting Information about R Objects
  • Examining a Vector
  • Mixing Types in a Vector
  • Factor Types
  • Factor Types
  • Conceptual Framework for Factors
  • Factors for Numerical Data
  • The forcats Package
  • Using fct_infreq()
  • Using fct_lump()
  • Lists
  • Naming List Elements
  • Apply Functions to Lists
  • Data Frames
  • The Tibble
  • Creating a Tibble From Vectors
  • Column Names That Are Non-syntactic
  • Creating a Tibble Using tribble()
  • Tibbles in Action
  • Matrices
  • Creating Matrices
  • Accessing Elements of a Matrix
  • Matrix Computations
  • Transpose and Matrix Multiplication
  • Querying a Data Set
  • Variable Exclusion I
  • Variable Exclusion II
  • Variable Exclusion III
  • Querying Columns From a Tibble
  • Querying Rows From a Tibble
  • Exploratory Data Analysis
  • The summarize() Function of dplyr
  • Working With summarize()
  • Using filter()
  • summary() Function

Hands-On Exercise 2.1

  • Advanced Summary Options
  • Aggregate Examples I
  • Aggregate Examples II
  • Aggregate Examples III
  • Aggregate Examples IV
  • Data Preparation: Data Frame Manipulation—bind_rows()
  • Data Preparation: Data Frame Manipulation—bind_cols()

Hands-On Exercise 2.2

  • Cleaning and Transforming the Data
  • Centring and Rescaling
  • Centring and Rescaling II
  • Normalizing
  • Missing Values
  • Missing Values
  • Dropping Rows with Missing Entries
  • Imputing Missing Values
  • Binning
  • Additional Recoding Options
  • Multilevel Recoding
  • The Function cut() in Action
  • General Approach for Multilevel Variable Recoding I
  • General Approach for Multilevel Variable Recoding II
  • Checking for Duplicates and Formatting Dates
  • Reordering a Data Set
  • Reordering Examples I
  • Reordering Examples II
  • Reordering Examples III
  • Sorting, Ranking, and Ordering Data
  • Joining Datasets
  • Inner Joins
  • Left Joins
  • Right Joins
  • Getting a Subset of Data
  • Another Example of Subset Function
  • Sampling

Hands-On Exercise 3.1

  • Base Graphics
  • Exploring Data Visualization
  • Explore the options in qplot()
  • Weather Data Set
  • Simple Graph Plotting
  • Graph Colouring With Attributes
  • Shape and Size to Graph
  • Box Plots and Violin Plots
  • Histogram
  • Density Plots
  • Graph Labelling
  • Pie Charts
  • Co-relationship in Data
  • Plotting Correlation of Three Variables
  • Correlations for All the Numeric Variables

Hands-On Exercise 4.1

  • tidymodel
  • Introduction to Regression
  • When Is Regression Used?
  • Sample Use Cases
  • Dependent and Independent Variables
  • Calculating Regression Equation
  • Multiple Linear Regression
  • Equation for Multiple Linear Regression
  • R’s Built-In Function for Linear Regression
  • Additional Linear Modelling functions
  • Example: Predicting Prestige
  • The Data Set
  • Exploring and Preparing the Data
  • Creating a Training and a Testing Data Set
  • The Model
  • Fitting a Linear Model to the Data
  • Making Predictions From the Model
  • Fitting the Model With Parsnip
  • Interpreting the Model
  • Interpreting the Model
  • Evaluating the Model
  • Evaluating the Model
  • Evaluating the Model
  • Tidying Up the Output

Hands-On Exercise 5.1

Need Help Finding The Right Training Solution?

Our training advisors are here for you.

Introduction to R FAQs

This course is suitable for:

  • Data wranglers who wish to prepare data sets for analysis.
  • Data engineers who create pipelines and deploy statistical and machine learning models.
  • Quantitative analysts who build statistical and machine learning models.
  • Business analysts who wish to use R’s graphical capabilities to visualize data.

R is a programming language for statistical computing, machine learning, and graphics.

Yes! After completing this course, we'd recommend the 1-day follow-on course 1269, Time Series Analysis Using R.