File downloaded from FDA Drug Shortages as of 9/2/2024
library(readr)
current.drug.shortages <- read_csv("~/Documents/MSQM/02 R/Week 2 Challenge/Drugshortages.csv")
company.shortages <- table(current.drug.shortages$`Company Name`)
2024-09-03
File downloaded from FDA Drug Shortages as of 9/2/2024
library(readr)
current.drug.shortages <- read_csv("~/Documents/MSQM/02 R/Week 2 Challenge/Drugshortages.csv")
company.shortages <- table(current.drug.shortages$`Company Name`)
round(mean(data.frame(company.shortages)$Freq))
## [1] 14
round(median(data.frame(company.shortages)$Freq))
## [1] 4
mode.shortages <- data.frame(table(data.frame(table(current.drug.shortages$`Company Name`))$Freq)) as.vector(mode.shortages$Var1)[mode.shortages$Freq==max(mode.shortages$Freq)]
## [1] "1"
most.shortages <- names(company.shortages)[company.shortages==max(company.shortages)] print(most.shortages)
## [1] "Hospira, Inc., a Pfizer Company"
## Reason No. of products ## 1 Delay in shipping of the drug 41 ## 2 Demand increase for the drug 40 ## 3 Discontinuation of the manufacture of the drug 5