R Programming

Course Overview

In this course you will learn how to program in R and how to use R for effective data analysis. You will learn how to install and configure software necessary for a statistical programming environment and describe generic programming language concepts as they are implemented in a high-level statistical language. The course covers practical issues in statistical computing which includes programming in R, reading data into R, accessing R packages, writing R functions, debugging, profiling R code, and organizing and commenting R code. Topics in statistical data analysis will provide working examples.

At the end of the training, participants will be able to:

  • Understand critical programming language concepts
  • Configure statistical programming software
  • Make use of R loop functions and debugging tools
  • Collect detailed information using R profiler

Pre-requisite

Fundamental understanding of any programming lanuage

Duration

3 days

Course Outline

What is R?
Why R?
Installing R For Windows, Mac OS, and Linux
R environment
How to get help in R
Writing and executing scripts
Installing packages

Understanding R data structure
Variables in R
Scalars
Vectors
Matrices
List
Extracting elements from vectors
Vector arithmetic
Simple patterned vectors
Character vectors
Data frames
Cbind,Rbind, attach and detach functions in R
Factors
Getting a subset of Data
Converting between vector types

Using functions in R
Apply Function Family
Commonly used Mathematical Functions
Commonly used Summary Functions
Commonly used String Functions
User defined functions
local and global variable
Working with dates

R Programming
While loop
If loop
For loop
Arithmetic operations

Importing data
Reading Tabular Data files
Reading CSV files
Importing data from excel
Loading and storing data with clipboard
Accessing database
Saving in R data
Loading R data objects
Writing data to file
Writing text and output from analyses to file
Saving and retrieving image files

Manipulating Data
Selecting rows/observations
Rounding Number
Creating string from variable
Search and Replace a string or Number
Selecting columns/fields
Missing Values
Working with Missing Values
Merging data
Relabeling the column names
Reshaping
Modifying Data Frame Variables 
Recoding Variables
The recode Function
Reshaping Data Frames
The reshape Package
Combining Data Frames
Under the Hood of merge

Data sorting
Data Aggregation
Road Map for Aggregation
Mapping a Function to a Vector or List
Mapping a function to a matrix or array
Mapping a Function Based on Groups
There shape Package
Finding and removing duplicate records

Character Manipulation
Basics of Character Data
Displaying and Concatenating Character
Working with Parts of Character Values
Regular Expressions in R
Basics of Regular Expressions
Breaking Apart Character Values
Using Regular Expressions in R
Substitutions and Tagging

Data Visualization
Base graphics system in R
Bar Charts and Dot Charts
Box plot
Histogram
Pie graph
Line chart
Scatterplot
Labels, legends, titles, axes
Quick plots (qplot function)
Building graphics by pieces (ggplot function)
low level graphics functions
Adding to plots and setting graphical parameters
Exporting graphics to different formats
Developing graphs
Cover all the current trending packages for Graphs

R and Databases
A Brief Guide to SQL
Navigation Commands
Basics of SQL
Aggregation
Joining Two Databases
Subqueries
Modifying Database Records

ODBC
Using the RODBC Package
The DBI Package
Accessing a MySQL Database
Performing Queries
Normalized Tables
Getting Data into MySQL
More Complex Aggregations