summary.correlate | R Documentation |
summary method for "correlate" class.
## S3 method for class 'correlate'
summary(object, ...)
object |
an object of class "correlate", usually, a result of a call to correlate(). |
... |
further arguments passed to or from other methods. |
summary.correlate compares the correlation coefficient by variables.
correlate
, plot.correlate
.
library(dplyr)
# Correlation type is "generic" ===============================
# Correlation coefficients of all numerical variables
corr_tab <- correlate(heartfailure)
corr_tab
# summary correlate class
mat <- summary(corr_tab)
mat
# Select the variable to compute
corr_tab <- correlate(heartfailure, creatinine, sodium)
corr_tab
# summary correlate class
mat <- summary(corr_tab)
mat
# Correlation type is "group" ===============================
##-----------------------------------------------------------
# If the target variable is a categorical variable
# Using dplyr
corr_tab <- heartfailure %>%
group_by(smoking, death_event) %>%
correlate()
corr_tab
# summary correlate class
mat <- summary(corr_tab)
mat
corr_tab <- heartfailure %>%
group_by(smoking, death_event) %>%
correlate(creatinine) %>%
filter(abs(coef_corr) >= 0.2)
corr_tab
# summary correlate class
mat <- summary(corr_tab)
mat
if (FALSE) {
# connect DBMS
con_sqlite <- DBI::dbConnect(RSQLite::SQLite(), ":memory:")
# copy heartfailure to the DBMS with a table named TB_HEARTFAILURE
copy_to(con_sqlite, heartfailure, name = "TB_HEARTFAILURE", overwrite = TRUE)
# Using pipes ---------------------------------
# Correlation coefficients of all numerical variables
corr_tab <- con_sqlite %>%
tbl("TB_HEARTFAILURE") %>%
correlate()
# summary correlate class
mat <- summary(corr_tab)
mat
# Disconnect DBMS
DBI::dbDisconnect(con_sqlite)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.