R and R Studio Introduction
R and R Studio Introduction
✓It contains advanced statistical routines not yet available in other packages.
➢ R is a free software environment for statistical computing and graphics. It’s open
source and therefore available free of charge.
➢ R studio is a powerful and productive user interface for R. It's free and open
source, and works great on Windows, Mac, and Linux.
✓ 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