LIS 4370: Module # 4 Programming structure in R
Module # 4 Programming structure in R
The distribution of blood pressure for patients classified according to their initial assessment will be visually shown by the boxplot. An overall picture of each patient's blood pressure distribution can be obtained from the histogram. How the first assessment changes for various blood pressure levels will be displayed in a boxplot. "Bad" and "good" initial assessments will be represented by a histogram.
An understanding of the relationship between blood pressure and the general practitioner's initial assessment can be found by looking at these plots and identifying trends, outliers, and the central tendency of the data.
Source Code:
Frequency <- c(0.6, 0.3, 0.4, 0.4, 0.2, 0.6, 0.3, 0.4, 0.9, 0.2)
BP <- c(103, 87, 32, 42, 59, 109, 78, 205, 135, 176)
First <- c(1, 1, 1, 1, 0, 0, 0, 0, NA, 1)
Second <- c(0, 0, 1, 1, 0, 0, 1, 1, 1, 1)
FinalDecision <- c(0, 1, 0, 1, 0, 1, 0, 1, 1, 1)
# Boxplots and Histograms
boxplot(BP ~ First, main="Boxplot of Blood Pressure by First Assessment", xlab="First Assessment (1=bad, 0=good)", ylab="Blood Pressure")
hist(BP, main="Histogram of Blood Pressure", xlab="Blood Pressure", col="lightblue", border="black")
boxplot(First ~ BP, main="Boxplot of First Assessment by Blood Pressure", xlab="Blood Pressure", ylab="First Assessment (1=bad, 0=good)")
hist(First, main="Histogram of First Assessment", xlab="First Assessment (1=bad, 0=good)", col="lightgreen", border="black")
Comments
Post a Comment