Professional Documents
Culture Documents
PRADIPTARATHI PANDA
ASSISTANT PROFESSOR, NISM, MUMBAI
WHY R?
✓It's free!
✓It contains advanced statistical routines not yet available in other packages.
✓R can be viewed as a programming language that comes with a large library of pre-
defined functions that can be used to perform various tasks.
WHY R LANGUAGE
✓R is not just a statistics package, it’s a language(allows you to specify the
performance of new tasks without any limitations)
✓R is designed to operate the way that problems are thought about and has very
simple syntax.
✓ R is both flexible and powerful.
✓It is very interactive and thus suitable for data analysis.
✓R syntax is very simple and intuitive. For instance,
✓ n <- 10 + 2
✓ n
✓ [1] 12
INSTALL R FOR WINDOWS
✓ Open R studio
UPGRADING R TO A SPECIFIC VERSION
FOR MAC:
• Restart R studio
Data Objects
R SCRIPT
✓ To know the current directory type getwd() without any argument in console.
✓ To change the working directory type setwd() with specified path
✓ setwd ( “path of the directory " )
✓ getwd ( )
DATA TYPES IN R
✓ Vectors
✓ Lists
✓ Matrices
✓ Arrays
✓ Factors
✓ Data Frames
VECTORS
• Vectors: Any object that contains data is called a data structure and numeric
vectors are the simplest type of data structure in R. In fact, even a single number
is considered a vector of length one.
✓ List: Lists are used to build more complex data structures. Can be created using
list() It creates objects which contain elements of different types like numbers,
strings and vectors
✓ Special type of vectors that can contains elements of different class
✓ X<-(1:70)
✓ Y<-(80:120)
✓ Z<-cbind(X+Y)
MATRIX