# NOT RUN {
# Visualize correlation plot of all numerical variables
plot_correlate(heartfailure)
# Select the variable to compute
plot_correlate(heartfailure, creatinine, sodium)
plot_correlate(heartfailure, -creatinine, -sodium)
plot_correlate(heartfailure, "creatinine", "sodium")
plot_correlate(heartfailure, 1)
plot_correlate(heartfailure, creatinine, sodium, method = "spearman")
# Using dplyr::grouped_dt
library(dplyr)
gdata <- group_by(heartfailure, smoking, death_event)
plot_correlate(gdata, "creatinine")
plot_correlate(gdata)
# Using pipes ---------------------------------
# Visualize correlation plot of all numerical variables
heartfailure %>%
plot_correlate()
# Positive values select variables
heartfailure %>%
plot_correlate(creatinine, sodium)
# Negative values to drop variables
heartfailure %>%
plot_correlate(-creatinine, -sodium)
# Positions values select variables
heartfailure %>%
plot_correlate(1)
# Positions values select variables
heartfailure %>%
plot_correlate(-1, -3, -5, -7)
# Using pipes & dplyr -------------------------
# Visualize correlation plot of 'creatinine' variable by 'smoking'
# and 'death_event' variables.
heartfailure %>%
group_by(smoking, death_event) %>%
plot_correlate(creatinine)
# Extract only those with 'smoking' variable level is "Yes",
# and visualize correlation plot of 'creatinine' variable by 'hblood_pressure'
# and 'death_event' variables.
heartfailure %>%
filter(smoking == "Yes") %>%
group_by(hblood_pressure, death_event) %>%
plot_correlate(creatinine)
# }
Run the code above in your browser using DataLab