R Language

R Programming
R is the most widely used tool for statistical programming. It is powerful, versatile and easy to use. It is the first
choice for thousands of data analysts working in both companies and academia. This course will help you master the
basics of R in a short time, as a first step to become a skilled R data scientist

Course content
1. Introduction
2. Getting Started With R

  • The RStudio Interface

  • Installing and Activating R Packages

  • Setting the Working Directory

  • Basic Operations in R

  •  Working With Variables

3. Vectors

  •  Creating Vectors With the c() Function
  • Creating Vectors Using the Colon Operator
  •  Creating Vectors With the rep() Function
  •  Creating Vectors With the seq() Function
  • Creating Vectors of Random Numbers
  •  Creating Empty Vectors
  •  Indexing Vectors With Numeric Indices
  •  Indexing Vectors With Logical Indices
  • Naming Vector Components
  •  Filtering Vectors
  •  The Functions all() and any()
  •  Sum and Product of Vector Components
  •  Vectorized Operations
  •  Treating Missing Values in Vectors
  •  Sorting Vectors
  •  Minimum and Maximum Values
  •  The ifelse() Function
  •  Adding and Multiplying Vectors
  •  Testing Vector Equality
  •  Vector Correlation
  •  Bonus Lecture: Learn Statistics with R
  •  Practical Exercises

4. Matrices And Arrays

  •  Creating Matrices With the matrix() Function

  • Creating Matrices With the rbind() and cbind() Functions

  • Naming Matrix Rows and Columns

  •  Indexing Matrices

  •  Filtering Matrices

  •  Editing Values in Matrices

  •  Adding and Deleting Rows and Columns

  •  Minima and Maxima in Matrices

  • Applying Functions to Matrices (1)

  •  Applying Functions to Matrices (2)

  •  Applying Functions to Matrices (3)

  •  Adding and Multiplying Matrices

  •  Other Matrix Operations

  •  Creating Multidimensional Arrays

  • Indexing Multidimensional Arrays

  •  Practical Exercises

5. Lists

  •  Create Lists With the list() Function
  •  Create Lists With the vector() Function
  •  Indexing Lists With Brackets
  •  Indexing Lists Using Objects Names
  •  Editing Values in Lists
  •  Adding and Removing List Objects
  •  Applying Functions to Lists
  • Practical Example of List: the Regression Analysis Output
  •  Bonus Lecture: Data Analysis in R
  •  Practical Exercises

6. Factors

  •  Working With Factors

  • Splitting a Vector By a Factor Levels

  •  The tapply() Function

  • The by() Function

  • Practical Exercises

7. Data Frames

  •  Creating Data Frames
  •  Loading Data Frames From External Files
  •  Writing Data Frames in External Files
  •  Indexing Data Frames As Lists
  •  Indexing Data Frames As Matrices
  •  Selecting a Random Sample of Entries
  •  Filtering Data Frames
  •  Editing Values in Data Frames
  • Adding Rows and Columns to Data Frames
  •  Naming Rows and Columns in Data Frames
  • Applying Functions to Data Frames
  •  Sorting Data Frames
  •  Shuffling Data Frames
  •  Merging Data Frames
  •  Practical Exercises

8. Programming Structures

  • For Loops

  •  While Loops

  •  Repeat Loops

  •  Nested For Loops

  •  Conditional Statements

  •  Nested Conditional Statements

  •  Loops and Conditional Statements

  •  User Defined Functions

  • The Return Command

  •  More Complex Functions Examples

  •  Checking Whether an Integer Is a Perfect Square

  • A Custom Function That Solves Quadratic Equations

  • Binary Operations

  •  Practical Exercises

9. Working With String

  •  Creating Strings

  •  Printing Strings

  •  Concatenating Strings

  •  String Manipulation (1)

  •  String Manipulation (2)

  •  String Manipulation (3)

  • Functions for Finding Patterns in Strings

  •  Functions for Replacing Patterns in Strings

  • Regular Expressions

  •  Practical Exercises

10. Plotting in Base R

  •  Building Scatterplot Charts
  •  Setting Graphical Parameters (1)
  • Setting Graphical Parameters (2)
  •  Adding a Trend Line to a Scatterplot
  •  Building a Clustered Scatterplot
  •  Plotting a Line Chart
  •  Setting the Line Parameters
  • Overplotting Lines and Dots
  •  Plotting Two Lines in the Same Chart
  •  Plotting Bar Charts
  • Setting the Bar Parameters
  • Plotting Histograms
  • Plotting Density Lines
  •  Plotting Pie Charts
  •  Plotting Boxplot Charts
  •  Plotting Functions
  •  Exporting Charts
  •  Bonus Lecture: More Advanced Plotting
  •  Practical Exercises
  • R Files and Data Frames

11. R File And Data Frames