Five Number Summary With R

 A Help For Beginner

We prepare the follow code to obtain a five number summary, Please these code. These are much more helpful for beginners (Errors or Omissions are Expected). 

#######################################################

Load the Data

data=read.csv(file.choose())

Import Data in R (Click Here)

Visualization of Data

fix(data)

Data Dimensions 

dim(data)

Select the Specific Column

x=data[,1]

Obtain the Length of Data

N=length(x)

Five Number Summary with Single Command

summary(x)

1-st Quartile

quartile1x=quantile(x,.25)

2-nd Quartile 

medianx=quantile(x,.50)

3-rd Quartile 

quartile3x=quantile(x,.75)

Mean of Data

mx=mean(x)

Median of Data

mdx=median(x)

Mode

getmode <- function(v) {

   uniqv <- unique(v)

   uniqv[which.max(tabulate(match(v, uniqv)))]

}

modx=getmode(x)

Variance

vx=var(x)

Standard Deviation 

sdx=sd(x)


Five Number Sumary by Box Plot (Click here)


Please write your suggestions

Comments

Post a Comment