Module # 4 Programming structure assignment

 VaShay Carpenter


Objective: The goal was to transform unstructured hospital observation data into a clean data frame to analyze the relationship between patient vitals (Blood Pressure) and clinical decision-making.

The following data was collected by the local hospital. This data set contains 5 variables based on the observation of 10 patients. In addition to the measurements of the patients checking in to the hospital that night, this data provides the patients' histories regarding the frequency of their visits to the hospital in the last 12 months.
This data displays the measurement of blood pressure, first assessment by a general doctor (bad=1, good =0) titled "first," the second assessment by an external doctor (called "second"), and the last row provides the head of the emergency unit's decision regarding immediate care for the patient based on the values 

0 or 1 (low = 0, high =1).


The names of your variables are as follows: 

"Freq","bloodp","first”, " second”, ”finaldecision”


The rows 
1.    "0.6","103","bad","low","low”
2.     "0.3","87","bad","low","high”
3.     "0.4","32","bad","high","low”
4.      "0.4","42","bad","high","high"
5.     "0.2","59","good","low","low”
6.      "0.6","109","good","low","high”
7.     "0.3","78","good","high","low”
8.      "0.4","205","good","high","high”
9.      "0.9","135",”NA","high","high"
10.    "0.2","176",”bad","high","high”


Here is a clarification hint:
Frequency <- c(0.6,0.3,0.4,......
BP <- c(103,87,32,42,.....
First <- c(1,1,1,.....
Second <- c(0,0,1,1,...
FinalDecision <- c(0,1,0,1,...

A. Your first assignment: Create a side-by-side boxplot (>boxplot(x, ...)) and and histogram (>hist(x,...)
In the following examples, I used different data containers for the boxplot and histogram visual display. 
1. Boxplot
I use the following data container (3,2,5,6,4,8,1,2,3,2,4)

A <- c(3, 2, 5, 6, 4, 8, 1, 2, 3, 2, 4)
boxplot(A)
Barplot.png  

2. Histogram I used following data container (2,4,5,7,12,14,16)
B <- c(2, 4, 5, 7, 12, 14, 16)
hist(B)

histogram.png  
B. 
Discuss the outcome of your results regarding patients BPs & MD’s Ratings.
C. Post your result in your blog and code on GitHub

https://github.com/cryo-cell/r-programming-assignments/blob/main/assignment4.Rmd



Methodology: Data was ingested as a character vector, shaped into a 5-column matrix, and converted to an R data frame. Categorical assessments ("good/bad", "low/high") were recoded into binary values (0/1) to allow for statistical plotting.

Visual Results and Discussion:

  1. Blood Pressure Distribution: The histogram reveals that most patients cluster around a BP of 100, but there is a notable gap between the majority and the extreme high-end readings.






  2. Outlier Detection: The boxplot of bloodp identifies a significant outlier at 205 BP. This patient represents a critical case that deviates from the standard patient profile in this sample.





  3. MD Rating Analysis: By plotting bloodp against finaldecision, a clear trend emerges: patients with BP readings exceeding 100 were almost exclusively categorized as "high" (1) priority for immediate care. The "low" (0) priority group maintained much lower, more stable blood pressure levels.





Comments

Popular posts from this blog

Assignment #9: Visualization in R – Base Graphics, Lattice, and ggplot2

Module # 6 Doing math in R part 2

Module #2 Assignment