I am currently working on a course in Six Sigma, and will make a dataset for this assignment.
I will be creating a bar chart and a pareto chart.
#install packages and dataset
install.packages("ggplot2")
install.packages("dplyr")
install.packages("qcc")
#load libraries
library(ggplot2)
library(dplyr)
library(qcc)
#create a data frame for the charts
df <- data.frame(product=c('Apple', 'Pear', 'Grapes', 'Banana', 'Orange', 'Pineapple'),
count=c(40, 57, 50, 82, 17, 16))
#take a look at my data
str(df)
## 'data.frame': 6 obs. of 2 variables:
## $ product: chr "Apple" "Pear" "Grapes" "Banana" ...
## $ count : num 40 57 50 82 17 16
Create a bar chart
ggplot(df, aes(x = product, y = count))+
geom_col()+
ggtitle("Favorite Fruit")
create a pareto chart
pareto.chart(df$count)
##
## Pareto chart analysis for df$count
## Frequency Cum.Freq. Percentage Cum.Percent.
## D 82.00000 82.00000 31.29771 31.29771
## B 57.00000 139.00000 21.75573 53.05344
## C 50.00000 189.00000 19.08397 72.13740
## A 40.00000 229.00000 15.26718 87.40458
## E 17.00000 246.00000 6.48855 93.89313
## F 16.00000 262.00000 6.10687 100.00000