In this assignment, I selected a dataset from UCI Machine Learning Repository. The research looked at patients who already had heart failure and investigated whether clinical characteristics could help predict survival/death during the follow-up period. The dataset contains 12 features and 299 patients. The variables contains such as age, diabetes, blood pressure, ejection fraction, serum creatinine, smoking, follow-up time, and death event. I chose this dataset because it includes a clear outcome variable, death event which indicates whether a patient died during the follow-up period and can be used for future analysis.
My plan is load data into R. I will then select a smaller set of meaningful variables that can provide useful information about the patients and their outcomes.
To make the data easier to understand, I will rename variables that are not immediately intuitive and convert binary variables coded as 0 and 1 into descriptive labels such as “Yes” and “No.” I will also include the death_event variable as the target variable. Finally, I will check the resulting data frame to make sure the selected variables have appropriate names, values, and data types.
Among people who already have heart failure, can information about their health and clinical measurements help us understand or predict who is more likely to survive?
Loading the tidyverse packages that I can use their packages
library(tidyverse)
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr 1.2.1 ✔ readr 2.2.0
✔ forcats 1.0.1 ✔ stringr 1.6.0
✔ ggplot2 4.0.3 ✔ tibble 3.3.1
✔ lubridate 1.9.5 ✔ tidyr 1.3.2
✔ purrr 1.2.2
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag() masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
To make the data easier to understand, I will rename variables that are not immediately intuitive and convert binary variables coded as 0 and 1 into descriptive labels such as “Yes” and “No.” I will also include the death_event variable as the target variable. Finally, I will check the resulting data frame to make sure the selected variables have appropriate names, values, and data types.
Among people who already have heart failure, can information about their health and clinical measurements help us understand or predict who is more likely to survive?
Loading the tidyverse packages that I can use their packages
Rows: 299 Columns: 13
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
dbl (13): age, anaemia, creatinine_phosphokinase, diabetes, ejection_fractio...
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.