How to create boxplot in R?

Description

To create a boxplot for the given data using R programming.

Boxplot:

  Measure how well data is distributedin a data set.

   Divides the data set into three quartiles.

   Represents the minimum, maximum,median, first quartile and thirdquartile in the data set.

  Useful in comparing the distributionof data across data sets by drawingboxplots for each of them.

   R Function : boxplot()

#Data Visualization in Box plot

#Read File
print(getwd())
setwd(“/home/soft13″)
print(getwd())
data<-read.csv(‘input.csv’)
print(data)

#Box Plot
age<-c(34,34,10,20,10,20,34,10)
boxplot(data$salary~age,main=”Box Plot”,xlab=”Age”,ylab=”Salary”,col=”green”)

#Adding Notch
boxplot(data$salary~age,main=”Box Plot”,xlab=”Age”,ylab=”Salary”,col=”green”,notch=TRUE)

Leave Comment

Your email address will not be published. Required fields are marked *

clear formSubmit