Assignments
Level - 1
getwd()
## [1] "E:/R Markdown"
Histogram
library(readxl)
Contractors <- read_excel("E:/Data Science/data science/datasets/ContractRenewal_Data.xlsx")
Promotions <- read_excel("E:/Data Science/data science/datasets/Promotion.xlsx")
Promotions <- Promotions[,-3]
colnames(Promotions) <- c("Credit", "Promotion.Type","InterestRateWaiver", "StandardPromotion")
attach(Contractors)
attach(Promotions)
hist(`Supplier A`, col = "lightblue")

hist(`Supplier B`, col = "lightblue")

hist(`Supplier C`, col = "lightblue")

hist(InterestRateWaiver, col = "lightblue")

hist(StandardPromotion, col = "lightblue")

Box plot
Contractors <- read_excel("E:/Data Science/data science/datasets/ContractRenewal_Data.xlsx")
Promotions <- read_excel("E:/Data Science/data science/datasets/Promotion.xlsx")
Promotions <- Promotions[,-3]
colnames(Promotions) <- c("Credit", "Promotion.Type","InterestRateWaiver", "StandardPromotion")
attach(Contractors)
## The following objects are masked from Contractors (pos = 4):
##
## Supplier A, Supplier B, Supplier C
attach(Promotions)
## The following objects are masked from Promotions (pos = 4):
##
## Credit, InterestRateWaiver, Promotion.Type, StandardPromotion
boxplot(`Supplier A`, ylab ="Frequency" , main = "Box Plot of Supplier A", boxfill = "lightblue")

boxplot(`Supplier B`, ylab = "Frequency", main = "Box Plot of Supplier B", boxfill = "lightblue")

boxplot(`Supplier C`, ylab = "Frequency", main = "Box Plot of Supplier C", boxfill = "lightblue")

boxplot(InterestRateWaiver, yab = "Frequency", main = "Box Plot of InterestRateWaiver", boxfill = "lightblue")

boxplot(StandardPromotion, yab = "Frequency", main = "Box Plot of StandardPromotion", boxfill = "lightblue")

Q_7 Solution
First Moment Business Decision
library(e1071)
VehicleSummary <- read.csv(file.choose())
VehicleSummary <-VehicleSummary[,-1]
colnames(VehicleSummary) <- c("Points", "Scores", "Weight")
attach(VehicleSummary)
mean(points)
## Warning in mean.default(points): argument is not numeric or logical:
## returning NA
## [1] NA
mean(Scores)
## [1] 98.76543
mean(Weight)
## [1] 121.5403
#median(sort(points, decreasing = FALSE, 3))
median(Scores)
## [1] 101
median(Weight)
## [1] 118.2087
Second Moment Business Decision
VehicleSummary <- read.csv(file.choose())
VehicleSummary <- VehicleSummary[,-1]
colnames(VehicleSummary) <- c("Points", "Scores", "Weight")
attach(VehicleSummary)
## The following objects are masked from VehicleSummary (pos = 3):
##
## NA, Points, Scores, Weight
var(Points)
## [1] 83.38328
var(Scores)
## [1] 497.3568
var(Weight)
## [1] 201.113
sd(Points)
## [1] 9.131445
sd(Scores)
## [1] 22.3015
sd(Weight)
## [1] 14.18143
Third and Fourth Moment Decison
Histogram of Vehicle Summary
VehicleSummary <- read.csv(file.choose())
VehicleSummary <- VehicleSummary[,-1]
colnames(VehicleSummary) <- c("Points", "Scores", "Weight")
attach(VehicleSummary)
## The following objects are masked from VehicleSummary (pos = 3):
##
## NA, Points, Scores, Weight
## The following objects are masked from VehicleSummary (pos = 4):
##
## NA, Points, Scores, Weight
skewness(Points) #include e1071 library
## [1] -0.1714104
skewness(Scores)
## [1] -0.5685176
skewness(Weight)
## [1] 1.552258
kurtosis(Points)
## [1] -0.7054604
kurtosis(Scores)
## [1] 0.6981942
kurtosis(Weight)
## [1] 2.583072
hist(Points, col = "lightblue")

hist(Scores, col = "lightblue")

hist(Weight, col = "lightblue")
