This week we were given data that we needed to convert into a data frame and then create a boxplot and a histogram to visualize the data. Below is the code I used to create my data frame “hospital_data” using the data.frame() function.

I decided to use ggplot2 to create my boxplots and histogram, as I am most comfortable with that package over base R, and because I enjoy the customization options that ggplot2 offers.
For my boxplots, I decided to make three boxplots to compare the average blood pressure and doctor decision in the First, Second, and Final decision. This required me to load the ggplot2 and gridExtra package to properly present and compare my boxplots


These boxplots allowed me to see that the first doctor favored low blood pressure patients, as opposed to the external doctor and ER doctor, who deemed higher blood pressure patients to be the top priority.


Meanwhile, my histogram shows frequency of hospital visits doesn’t necessarily translate to higher priority cases, at least in terms of blood pressure cases.
As always, link to my Github: here
Leave a comment