corr_plot | R Documentation |
corr_plot
takes CSPP data from get_cspp_data
and returns
either a correlation matrix or correlation plot.
corr_plot( data = NULL, vars = NULL, summarize = TRUE, labels = TRUE, label_size = 3, colors = c("#6D9EC1", "#FFFFFF", "#E46726"), cor_matrix = FALSE )
data |
A dataframe. If data is generated by |
vars |
Default is NULL. If left NULL, uses all variables within the passed dataframe. Otherwise, must be a character vector. The dataframe is subset based on variables listed. |
summarize |
Default is TRUE. If TRUE, and if the variable |
labels |
Default is TRUE. If TRUE, the correlation plot will include labels for the correlation value. If FALSE, no labels will be present. |
label_size |
Default is 3. Controls the size of the font for labels. |
colors |
Specify the colors to be used in the correlation plot. Must include three values in a character vector format. The default values are 'c("#6D9EC1", "#FFFFFF", "#E46726")'. |
cor_matrix |
Default is FALSE. If set to TRUE, instead of returning a
ggplot object that is a correlation plot, returns a correlation matrix.
This is particularly useful if you want to customize the output with
|
This function is a wrapper that passes a dataframe to the
ggcorrplot::ggcorrplot
function which generates correlation heat
plots.
ggplot2 object or correlation matrix
ggcorrplot
corr_plot(data = get_cspp_data(), vars = c("pollib_median", "innovatescore_boehmkeskinner", "citi6013", "ranney4_control", "h_diffs"), cor_matrix = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.