1 Objective of Study

In this study, we would like to determine what factors are causing a delay in the time that an X-Ray order is completed.

2 Load Data

We are going to load the data RadDat_CareOne.csv into R. Note that this data has errors.

url <- "https://raw.githubusercontent.com/tmatis12/datafiles/refs/heads/main/RadDat_CareOne.csv"
df <- read.csv(url, stringsAsFactors = FALSE)

2.1 Change Variable Types

We need to change the variable types in R

df <- df %>%
  mutate(
    CatalogCode = as.factor(CatalogCode),
    PatientTypeMnemonic = as.factor(PatientTypeMnemonic),
    Encounter.Type = as.factor(Encounter.Type),
    Priority = as.factor(Priority),
    Loc.At.Exam.Complete = as.factor(Loc.At.Exam.Complete),
    Exam.Completed.Bucket = as.factor(Exam.Completed.Bucket),
    Section = as.factor(Section),
    Exam.Room = as.factor(Exam.Room),
    Unique.Identifier = as.character(Unique.Identifier),
    Radiology.Technician = as.factor(Radiology.Technician)# ID should remain a character
  )

# Convert date-time columns
df <- df %>%
  mutate(
    OrderDateTime = mdy_hm(OrderDateTime),
    ExamCompleteDateTime = mdy_hm(ExamCompleteDateTime),
    FinalDateTime = mdy_hm(FinalDateTime)
  )

3 Do some Visualizations

We want to do some visualizations

3.1 Two way visualization

boxplot(df$PatientAge~df$Priority)

4 Complete R Code

It is a good idea to include this at the end of every RMarkdown document

head(cars)
knitr::kable(head(cars))
mean(cars$speed)
plot(cars)