Introduction to R Programming

3 Days

In this R training course, students learn to program by diving into the R language and then use their new-found skills to solve practical data science problems. They'll learn how to load data, assemble and disassemble data objects, navigate R's environment system, write functions, and use all of R's programming tools.

Goals
  1. Work hands-on with three practical data analysis projects based on casino games.
  2. Store, retrieve, and change data values in your computer's memory.
  3. Write programs and simulations that outperform those written by typical R users.
  4. Use R programming tools such as if else statements, for loops, and S3 classes.
  5. Learn how to write lightning-fast vectorized R code.
  6. Take advantage of R's package system and debugging tools.
  7. Practice and apply R programming concepts as you learn them.
Outline
  1. Project 1: Weighted Dice
    1. The Very Basics
      1. The R User Interface
      2. Objects
      3. Functions
      4. Sample with Replacement
      5. Writing Your Own Functions
      6. Arguments
      7. Scripts
    2. Packages and Help Pages
      1. Packages
        1. install.packages
        2. library
      2. Getting Help with Help Pages
      3. Parts of a Help Page
  2. Project 2: Playing Cards
    1. R Objects
      1. Atomic Vectors
        1. Doubles
        2. Integers
        3. Characters
        4. Logicals
        5. Complex and Raw
      2. Attributes
        1. Names
        2. Dim
      3. Matrices
      4. Arrays
      5. Class
        1. Dates and Times
        2. Factors
      6. Coercion
      7. Lists
      8. Data Frames
    2. Loading Data
    3. Saving Data
    4. R Notation
      1. Selecting Values
        1. Positive Integers
        2. Negative Integers
        3. Zero
        4. Blank Spaces
        5. Logical Values
        6. Names
      2. Deal a Card
      3. Shuffle the Deck
      4. Dollar Signs and Double Brackets
    5. Modifying Values
      1. Changing Values in Place
      2. Logical Subsetting
        1. Logical Tests
        2. Boolean Operators
      3. Missing Information
        1. na.rm
        2. is.na
    6. Environments
      1. Environments
      2. Working with Environments
        1. The Active Environment
      3. Scoping Rules
      4. Assignment
      5. Evaluation
      6. Closures
  3. Project 3: Slot Machine
    1. Programs
      1. Strategy
        1. Sequential Steps
        2. Parallel Cases
      2. if Statements
      3. else Statements
      4. Lookup Tables
      5. Code Comments
      6. S3
      7. The S3 System
      8. Attributes
      9. Generic Functions
      10. Methods
        1. Method Dispatch
      11. Classes
      12. S3 and Debugging
      13. S4 and R5
    2. Loops
      1. Expected Values
      2. expand.grid
      3. for Loops
      4. while Loops
      5. repeat Loops
    3. Speed
      1. Vectorized Code
      2. How to Write Vectorized Code
      3. How to Write Fast for Loops in R
      4. Vectorized Code in Practice
      5. Loops Versus Vectorized Code
    4. Installing R and RStudio
      1. How to Download and Install R
        1. Windows
        2. Mac
        3. Linux
      2. Using R
      3. RStudio
      4. Opening R
    5. R Packages
      1. Installing Packages
      2. Loading Packages
    6. Updating R and Its Packages
      1. R Packages
    7. Loading and Saving Data in R
      1. Data Sets in Base R
      2. Working Directory
      3. Plain-text Files
        1. read.table
          1. sep
          2. header
          3. na.strings
          4. skip and nrow
          5. stringsAsFactors
        2. The read Family
        3. read.fwf
        4. HTML Links
        5. Saving Plain-Text Files
        6. Compressing Files
      4. R Files
        1. Saving R Files
      5. Excel Spreadsheets
        1. Export from Excel
        2. Copy and Paste
        3. XLConnect
        4. Reading Spreadsheets
        5. Writing Spreadsheets
      6. Loading Files from Other Programs
        1. Connecting to Databases
    8. Debugging R Code
      1. traceback
      2. browser
      3. Break Points
      4. debug
      5. trace
      6. recover
Class Materials

Each student in our Live Online and our Onsite classes receives a comprehensive set of materials, including course notes and all the class examples.