#loading in csv file and also loading in potentially useful packages.
library(dplyr) dataxray <- read.csv(“https://raw.githubusercontent.com/tmatis12/datafiles/refs/heads/main/RadDat_IMSE.csv”) dataxray
#data filtering step
any(dataxray\(Ordered.to.Complete...Mins < 0) # check for negative values and other filtering out conditions any(dataxray\)Ordered.to.Complete…Hours < 0)
#results show true
filtereddata <- dataxray %>% filter(Ordered.to.Complete…Mins >= 0, Ordered.to.Complete…Hours >= 0)
any(filtereddata\(Ordered.to.Complete...Mins < 0) any(filtereddata\)Ordered.to.Complete…Hours < 0)
#now results show false, no negative values seen
medicare_data <- filtered_data[filtered_data$PatientAge >= 65, ]
Q1 <- quantile(medicare_data\(Ordered.to.Complete...Mins, 0.25) Q3 <- quantile(medicare_data\)Ordered.to.Complete…Mins, 0.75) IQR_min <- Q3 - Q1 IQR_min
medicare_data_IQR <- medicare_data[medicare_data\(Ordered.to.Complete...Mins >= Q1 & medicare_data\)Ordered.to.Complete…Mins <= Q3, ]
hist(medicare_data_IQR$Ordered.to.Complete…Mins, main = “IQR of Completion Times”, xlab = “Completion Time (Minutes)”, col = “green”)
qqnorm(medicare_data_IQR\(Ordered.to.Complete...Mins) qqline(medicare_data_IQR\)Ordered.to.Complete…Mins, col = “blue”)
#2.
technicians_62_65 <- filtered_data %>% filter(Radiology.Technician >= 62 & Radiology.Technician <= 65)
boxplot(Ordered.to.Complete…Mins ~ Radiology.Technician, technicians_62_65,main = “Median Completion Time by Radiology Technician”,xlab = “Radiology Technician”,ylab = “Completion Time (Minutes)”,col = “red”, ylim = c(0, 300)) # Adjust this limit based on your data
#3. Generate a side by side box plot comparing the age of those patients receiving STAT versus Routine orders for an X-Ray. What do these box plots tell you?
patientsSTATRoutine <- filtered_data[filtered_data$Priority %in% c(“STAT”, “Routine”), ]
boxplot(PatientAge ~ Priority, col = c(“red”, “blue”),
data = patientsSTATRoutine, main = “Patient Age by Order Type (STAT vs
Routine)”, xlab = “Order Type”, ylab = “Age (years)”, names = c(“Rout”,
“STA”)) # I shortened it so the group names show up.
#filtering the already filtered df floors_data <- filtered_data[filtered_data$Loc.At.Exam.Complete %in% c(“3W”, “4W”), ]
#mean and sd summary_stats <- aggregate(Ordered.to.Complete…Mins ~ Loc.At.Exam.Complete, data = floors_data, FUN = function(x) c(mean = mean(x, na.rm = TRUE), sd = sd(x, na.rm = TRUE))) summary_stats