Description Usage Arguments Details Value Author(s) Examples
Takes a matrix or dataframe and calculates the pairwise correlations between all columns. Plots these as a ggplot tilemap. Optionally returns the pairwise correlations as a tidy tibble.
1 2 3 4 5 6 | PlotPairwiseCorrelations(
M,
axis.label = NULL,
return.corr.tibble = FALSE,
plotit = TRUE
)
|
M |
A matrix or dataframe for which the pairwise corrlelations between the columns are desired. |
axis.label |
Optional label for x,y figure axes, Default: NULL |
return.corr.tibble |
Return the correlations?, Default: FALSE |
plotit |
Plot the correlations, Default: TRUE |
Ideas for code taken from here: http://www.sthda.com/english/wiki/ggplot2-quick-correlation-matrix-heatmap-r-software-and-data-visualization
Default: a ggplot2 object, optionally the correlations as a tibble.
Andrew Dolman
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ## Not run:
if(interactive()) {
M <- matrix(rnorm(12 * 100), ncol = 12)
PlotPairwiseCorrelations(M, axis.label = "Month",
return.corr.tibble = TRUE)
# Add names to columns
colnames(M) <- letters[1:12]
PlotPairwiseCorrelations(M, axis.label = "Cat",
return.corr.tibble = TRUE)
}
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.