Basic Stats Commands

To read data from CSV file

mba <-read.csv("C:\\Data Science\\dataset\\mba.csv")

To get the dimensions (row and column)

dim(mba)
## [1] 773   3

To get the column name

colnames(mba)
## [1] "data.srno" "workex"    "gmat"

To set R Object (mba) to Search Path

attach(mba)

To get the mean, median, max, min, range and standard deviation for column

mean(workex)
## [1] 57.50194
median(workex)
## [1] 52
max(workex)
## [1] 279
min(workex)
## [1] 9
range(workex)
## [1]   9 279
sd(workex)
## [1] 27.38682

To identify skewness, plot and kurtosis - e1071 library loaded

library(e1071)
## Warning: package 'e1071' was built under R version 3.4.4
skewness(workex)
## [1] 2.598422
plot(workex)

hist(workex)

barplot(gmat)

boxplot(gmat)

hist(gmat)

kurtosis(workex)
## [1] 13.26826
kurtosis(gmat)
## [1] 1.141141

To identify the Structure of Object

str(mba)
## 'data.frame':    773 obs. of  3 variables:
##  $ data.srno: int  1 2 3 4 5 6 7 8 9 10 ...
##  $ workex   : int  21 107 57 99 208 136 70 103 79 22 ...
##  $ gmat     : int  720 640 740 690 710 660 660 710 700 730 ...

To get the current working directory

getwd()
## [1] "C:/Data Science/R"

To get the Summary of Object

summary(mba)
##    data.srno       workex           gmat      
##  Min.   :  1   Min.   :  9.0   Min.   :600.0  
##  1st Qu.:194   1st Qu.: 41.0   1st Qu.:690.0  
##  Median :387   Median : 52.0   Median :710.0  
##  Mean   :387   Mean   : 57.5   Mean   :711.2  
##  3rd Qu.:580   3rd Qu.: 69.0   3rd Qu.:730.0  
##  Max.   :773   Max.   :279.0   Max.   :780.0