Tuesday, September 23, 2014

R Statistical Software Basics - Descriptive Statistics - Minimum, Maximum & Range Functions

The practice sheet titled StatisticMarks Data.csv downloaded from Link. – Download Sheet

About the Data Sheet - The data in this sheet is related to marks scored by 100 Students in a Statistical Test.

Based on the data, we will use R Software Statistical functions to analyze the descriptive statistics.

In the Data Sheet, we have Data from A2:A101, A1 being the header of the Data.

I have stored the StatisticMarks.csv file in Working Directory on my Desktop.

setwd("C:/Users/Rajesh Prabhakar/Desktop/R")

For inputting or reading Data from “StatisticMarks.csv” file, R Command would be

StatMarks=read.csv("StatisticMarks.csv")

I have named input variable name as StatMarks so that it will be easy for reading data into the statistical function formulas.
Click Ctrl R or Run or Ctrl plus Enter Tabs

Minimum Function
min( )

This function returns the minimum value in the data. Function name must be small caps

min(StatMarks)

Result is 25

The lowest marks scored is 25

Maximum Function

max(  )

This function returns the maximum value in the data. Function name must be small caps

max(StatMarks)

Result is 100

The Highest marks scored in test is 100.

Result in R Console 
 
> min(StatMarks)
[1] 25
> max(StatMarks)
[1] 100

Range Function
range(   )
This function gives a vector of the minimum and maximum values.

range(StatMarks)

Result is 25 & 100

These are the lowest and highest numbers in Data Set.

> range(StatMarks)
[1]  25 100
 
Range or Spread

For getting the range or spread i.e Range = Maximum – Minimum
 
max(StatMarks)-min(StatMarks) 
 
Result is 75 
 
The difference between 100 – 25 = 75 
 
Result in R Console 
 
> max(StatMarks)-min(StatMarks)
[1] 75

No comments:

Post a Comment