# \donttest{
library(dplyr)
# correlate type is generic ==================================
tab_corr <- correlate(iris)
tab_corr
# visualize correlate class
plot(tab_corr)
tab_corr <- iris %>%
correlate(Sepal.Length, Petal.Length)
tab_corr
# visualize correlate class
plot(tab_corr)
# correlate type is group ====================================
# Draw a correlation matrix plot by category of Species.
tab_corr <- iris %>%
group_by(Species) %>%
correlate()
# plot correlate class
plot(tab_corr)
## S3 method for correlate class by 'tbl_dbi' ================
# If you have the 'DBI' and 'RSQLite' packages installed, perform the code block:
if (FALSE) {
# connect DBMS
con_sqlite <- DBI::dbConnect(RSQLite::SQLite(), ":memory:")
# copy iris to the DBMS with a table named TB_IRIS
copy_to(con_sqlite, iris, name = "TB_IRIS", overwrite = TRUE)
# correlation coefficients of all numerical variables
tab_corr <- con_sqlite %>%
tbl("TB_IRIS") %>%
correlate()
plot(tab_corr)
# Disconnect DBMS
DBI::dbDisconnect(con_sqlite)
}
# }
Run the code above in your browser using DataLab