R Programming – Data Science Analytics

R for Data Science/Analytics / Automation

Custom Projects course (R Data Science tutors in New York) Introduction to  R Course Fee : $100 (Online Course) / $25/hr Onsite

R Tutors Data Science and R Classes also available in Downtown Manhattan New York  @ $25/hour

Course is based on four text:

  • R for Data Science- Import, Tidy, Transform, Visualize, and Model Data
  • Machine Learning for Hackers
  • Ggplot2 Elegant Graphics for Data Analysis
  • R in a nutshell

Learning R – R Programming for Data Science/Analytics/quant course New York – Live Instructor Based one on one course – Projects similar to what you do at your job!

Some learners say that they feel R is mix of MATLAB and SAS if I were to relate to the other 2 tools used in Finance. R is having mix of maths and data handling powers of SAS and given that it is open source it is the best choice for research. R is MATLAB when it comes to syntax. When it comes to data handling it uses R MySQL in the very same way as SAS does. Hence it does things that SAS+MATLAB do for free. SQL has inherent limitations of doing quant computations, and MATLAB is heave and requires too much resources. MATLAB is not very good to deal with SQL at system level. But to start with one needs to also know VBA as for entry level and easy task VBA is preferred.

Also, you would learn the application of R for quantitative finance.

 Introduction to the R Programming for Data Science

  • Some background on R, how to obtain and how to install it
  • R documentation and available help and web resources
  • R Console and R GUI
  • Data import, data types and variables
  • Elementary import functions
  • Data types
  • Variable generation, inspection and modification
  • Graphics in R for Data Science
  • Command “plot” and where to plot to
  • Setting the setting: par
  • High-level and low-level plotting functions legends
  • Math in plots
  • Hands-on Session—data handling & graphics
  • Simulations in R for Data Analytics
  • Simulating from given distributions
  • Risk management basics
  • Data Structures in R
  • Review of types of objects
  • Additional object types
  • Basics of the R Language
  • Conditionals & Loops
  • Writing R Functions:  Basic functions
  • Object-orientation
  • Debugging
  • Application in Finance
  • Calculating Value at Risk
  • Packages for Portfolio Optimization


  1. 10 hours on handling data, functions, indexing, functions, structures, data linkages, importing, SQL, etc
  2. 10 hours on Financial Commands, tools, pre built libraries


Course Description:

One on One course Introductory course for R. 4 hours of basics of R to get you started in R. Flexible timings with personalized approach by Experienced Faculty. Online tests to prepare yourself better. This course will help you in:

  • Add to the profile by learning R.
  • Provides a base for learning advanced R.
  • Gives you a perfect platform for launching a career in R.
  • Gain the knowledge of  integration with excel  .


Course Structure:

Class No.

Topic List: R for Data Science / Analytics

Class duration


Installing R, Intro to R packages, R as calculator

1 hour


Matrix in R, Indexing in R, Intro to ARIMA, Regression in R

1 hour


Connecting R with Excel, Importing CSV, Input methods, connecting R with external sources feeds like QuantDL

1 hour


Revision/Doubt Clearing

1 hour


The Benefits of Using R :

  • R is free, open-source code
  • R programming helps you runs R anywhere
  • R supports extensions
  • R provides an engaged community
  • R connects with other languages

Tutorials contributed by learners and tutors-



Other Details -

Some links to get yourself acquainted on R:














Functions of R / R Commands to be covered in the course:


Always save workspace

Use “c” when you want to use it a signal in black schools formula

 read.table function will be used to get the data into R (/\ used opposite than the one used in windows)


Example 1

> test.txt <- read.table (“C:/Documents and Settings/shivbhakta.joshi/My

Documents/test.txt”, header=T)

> print(test.txt)

> column <- test.txt[,c('make','price')]

Example 2

grb <- read.table (“C:/Documents and Settings/shivbhakta.joshi/My

Documents/GRB_afterglow.dat”, header=T, skip=1)

x <- (grb[,1])


Grabbing data from tables into an single dimensional arrayx <- (grb[,1])

y <- log(grb[,1])

Another way to create returns for stock daily return is

f=dft$age/dft$price (using dollar sign extraction)

Deleting column http://www.sr.bham.ac.uk/~ajrs/R/r-manipulate_data.html

> add <- add[-2] to delete the element 2nd

Adding data to array busing column command

> add <- c(1,d)


Using Data frames

Data.frame is used to combine the arrays back into table format

people = data.frame (x,y)

Write.CSV command executed


grb <- read.table (“C:/Documents and Settings/satyadhar.joshi/My

Documents/GRB_afterglow.dat”, header=T, skip=1)

x <- (grb[,1])

y <- log(grb[,1])

people = data.frame (x,y)


These methods can be used to compute beta from columns of a csv file


Working formula of Blach Scholes

BS <-

function(S, K, T, r, sig, type=”C”){

d1 <- (log(S/K) + (r + sig^2/2)*T) / (sig*sqrt(T))

d2 <- d1 – sig*sqrt(T)


value <- S*pnorm(d1) – K*exp(-r*T)*pnorm(d2)



value <- K*exp(-r*T)*pnorm(-d2) – S*pnorm(-d1)





blackscholes <- function(s, k, r=.1, t=5, sigma=.9,call=TRUE) {

#calculate call/put option

d1 <- (log(s/k)+(r+sigma^2/2)*t)/(sigma*sqrt(t))

d2 <- d1 – sigma * sqrt(t)

ifelse(call==TRUE,s*pnorm(d1) – k*exp(-r*t)*pnorm(d2),k*exp(-r*t)

* pnorm(-d2) – s*pnorm(-d1))



Predefined Black schools model:


black_scholes (“c”,5600,5600,.1,.08,.22 )

this depicts use of functions in R


Merton Distance to Default (different as per needs)

(modified from Black Scholes formula, still

unsure about pnorm() function)

d1 <- (log(s/k)+(sigma^2/2))/(sigma)



3 files needed to run the demos are available on internet by various authors:

  1. black_scholes.R
  2. GRB_afterglow.dat
  3. test.txt





R code for Breaking X/Y axis

# http://stackoverflow.com/questions/19612348/break-x-axis-in-r
# http://www.statmethods.net/advgraphs/axes.html
# http://www.inside-r.org/packages/cran/plotrix/docs/axis.break# Example 1
x <- c(9.45, 8.78, 0.93, 0.47, 0.24, 0.12)
y <- c(10.72, 10.56, 10.35, 10.10, 9.13, 6.72)
z <- c(7.578, 7.456, 6.956, 6.712, 4.832, 3.345)
plot(x, y, col=’blue’, pch=16, xlab= ‘x’, ylab=’y, z’)
points(x, z, col=’red’, pch=17)
axis.break(1,2,style=”slash”)#Break X axisxgap <- ifelse(x > 8, x-6, x)
#Possibly you’d want to check if there are values between 2 and 8.
plot(xgap, y, col=’blue’, pch=16, xlab= ‘x’, ylab=’y, z’, xaxt=”n”)
points(xgap, z, col=’red’, pch=17)
xat <- pretty(xgap)
xat <- xat[xat!=2]
xlab <- ifelse(xat>2, xat+6, xat)
axis(1,at=xat, labels=xlab)

par(bty=”n”) # deleting the box
gap.plot(x,y, gap=c(2,7.5), gap.axis=”x”, pch=16,
col=”blue”, ylim=range(c(y,z)),
xtics=c(0:3,8:10), xticlab=c(0:3,8:10))

gap.plot(x,z, gap=c(2,7.5), gap.axis=”x”, pch=17,
col=”red”, ylim=range(c(y,z)), add=TRUE); axis(2)

abline(v=seq(1.99,2.09,.001), col=”white”)  # hiding vertical lines

# Break Y Axis

ygap <- ifelse(y > 8, y-6, y)
#Possibly you’d want to check if there are values between 2 and 8.
plot(ygap, x, col=’blue’, pch=16, xlab= ‘x’, ylab=’y, z’, yaxt=”n”)
points(ygap, z, col=’red’, pch=17)
yat <- pretty(ygap)
yat <- yat[yat!=2]
ylab <- ifelse(yat>2, yat+6, yat)
axis(2,at=yat, labels=ylab)


One on One Customized Training:

qcfinance.in believes in personalized touch so that our clients are completely satisfied with our service. In this regard, we offer One on One Customized Training to our clients.

These Training are provided on requests by our clients & are customized according to their individual needs at various cities.

Tutors and Volunteers available in Manhattan, New York.

The course structure & timings for these training are highly flexible, classes are scheduled as per the convenience of our clients.

 R programming tutors in Manhattan New York for Data Science 

Note: If you miss a scheduled one on one class, then don’t worry, you can reschedule it at your convenient time & the missed class won’t be counted. You may defer a class any number of time. Also, you get life time access to materials which gets constantly updated.

Course Instructor:


Contact Us: info@qcfinance.in

Depreciated: COURSE LINK - Introduction to R

Comments are closed.