How to measure the dispersion of the given data using R?

Description

To measure the dispersion of the given data in R programming.

Measures of dispersion

  • Range or Variation
  • Variance
  • Standard deviation

1) Range or variation :

  • Range is the difference between the smallest and highest value.
  • R Function : range()

2) Variance :

  • Variance is the measure of how far is data vary from the average value.
  • R Function : var()

3) Standard Deviation :

  • Standard deviation is the square root of the variance.
  • R Function : sd()

#Measure of Dispersion

#Read File
print(getwd())
setwd(“/home/sof#Measure of Dispersion

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

#Range
range(data$salary)

#Variance
var(data$salary)

#Standard Deviation
sd(data$salat13″)
print(getwd())
data<-read.csv(‘input.csv’)
print(data)
print(is.data.frame(data))

#Range
range(data$salary)

#Variance
var(data$salary)

#Standard Deviation
sd(data$salary)

Leave Comment

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

clear formSubmit