Make dotplots of blood pressure for emergency vs elective admission patients. Try different numbers of bins or binwidths.
Make a scatterplot of blood pressure (Y) vs age (X). Add a straight line to the plot. Does it look like blood pressure increases, decreases, or is relatively stable over ages?
Source Code
---title: "BTS 510 Lab 4"format: html: embed-resources: true self-contained-math: true html-math-method: katex number-sections: true toc: true code-tools: true code-block-bg: true code-block-border-left: "#31BAE9"---```{r}#| label: setupset.seed(12345)library(tidyverse)library(Stat2Data)theme_set(theme_classic(base_size =16))```## Learning objectives* Select an **appropriate plot** for the **variable type*** Create plots in **ggplot2** ## Data * `ICU` data from the **Stat2Data** package * `ID`: Patient ID code * `Survive`: 1 = patient survived to discharge or 0 = patient died * `Age`: Age (in years) * `AgeGroup`: 1 = young (under 50), 2 = middle (50-69), 3 = old (70+) * `Sex`: 1 = female or 0 = male * `Infection`: 1 = infection suspected or 0 = no infection * `SysBP`: Systolic blood pressure (in mm of Hg) * `Pulse`: Heart rate (beats per minute) * `Emergency`: 1 = emergency admission or 0 = elective admission* Convert the factor variables to factor variables, as in the lecture * `as.factor()` function## Tasks1. Make a histogram of blood pressure. Make the bars grey with a black outline. Add vertical lines at the standard cutoffs ([https://newsroom.heart.org/news/high-blood-pressure-redefined-for-first-time-in-14-years-130-is-the-new-high](https://newsroom.heart.org/news/high-blood-pressure-redefined-for-first-time-in-14-years-130-is-the-new-high)) of 120, 130, and 140. Make those lines green, yellow, and red, respectively.2. Make dotplots of blood pressure for emergency vs elective admission patients. Try different numbers of bins or binwidths. 3. Make a scatterplot of blood pressure (Y) vs age (X). Add a straight line to the plot. Does it look like blood pressure increases, decreases, or is relatively stable over ages?