# NOT RUN {
# Generate data for the example
heartfailure2 <- heartfailure[, c("platelets", "creatinine", "sodium")]
library(dplyr)
# Compare the all numerical variables
all_var <- compare_numeric(heartfailure2)
# Print compare_numeric class object
all_var
# Compare the correlation that case of joint the sodium variable
all_var %>%
"$"(correlation) %>%
filter(var1 == "sodium" | var2 == "sodium") %>%
arrange(desc(abs(coef_corr)))
# Compare the correlation that case of abs(coef_corr) > 0.1
all_var %>%
"$"(correlation) %>%
filter(abs(coef_corr) > 0.1)
# Compare the linear model that case of joint the sodium variable
all_var %>%
"$"(linear) %>%
filter(var1 == "sodium" | var2 == "sodium") %>%
arrange(desc(r.squared))
# Compare the two numerical variables
two_var <- compare_numeric(heartfailure2, sodium, creatinine)
# Print compare_numeric class objects
two_var
# Summary the all case : Return a invisible copy of an object.
stat <- summary(all_var)
# Just correlation
summary(all_var, method = "correlation")
# Just correlation condition by r > 0.1
summary(all_var, method = "correlation", thres_corr = 0.1)
# linear model summaries condition by R^2 > 0.05
summary(all_var, thres_rs = 0.05)
# verbose is FALSE
summary(all_var, verbose = FALSE)
# plot all pair of variables
# plot(all_var)
# plot a pair of variables
# plot(two_var)
# plot all pair of variables by prompt
# plot(all_var, prompt = TRUE)
# plot a pair of variables not focuses on typographic elements
# plot(two_var, typographic = FALSE)
# }
Run the code above in your browser using DataLab