Professional Documents
Culture Documents
Introduction of R
• Deals with statistical computation of data &
graphical representations.
• Developed at Bell laboratories, by John
Chambers & colleagues.
• Includes :
• Linear- nonlinear modelling
• Classical statistical test
• Time-series analysis, etc.
• Widely used by data scientists.
basic commands
Command Application Sample
X=12
1 Assign value
X<- 12
5 ^ square 24^4
seq(12,40,3)
seq(from=a ,to= b,
8 sequence From 12 to 40 by increment
by=c)
of 3
Command Application Sample
rep(c(24,”vijay”)),
12 rep( c() , times) To repeat multiple values
times=10)
Y= c(24,15,54,9)
13 Y[] Call values
Y[c(1,4)] = 24 & 9
Call all values except bth
14 Y[-b ] Y[-4] = 24,15,54
element
To add notes or
# call all values of Y
15 # lines that we don’t want to run
except 4th element
as command
matrix(c(a,b,c,d), matrix(c(4,5,8,2), nrow
16 Build matrix
nrow = y, byrow = T) = 2, byrow = T)
Command Application Sample
Std. deviation ,
3. sd(age) , var(age)
variance
6. covariance cov(age,height)
• lines(smooth.spline(age[result=="p"] ),lwd= 3)
• abline(lm(height~age))
• abline(h= 60)