Description Usage Arguments Details Author(s) Examples
Generate a matrix or non-matrix style heatmap of correlation coefficients.
1 2 3 4 |
data |
The dataset to plot. |
x |
The x axis variables. |
y |
The y axis variables. |
x.name.sub |
The substitutions to the x axis names, incase
the original variables need to be clarified (eg. 'Wgt' to
'Weight'). Use (probably) best command to use is the |
y.name.sub |
Same as the |
heat.colours |
The spectrum of colours for the heat map, as a vector between the lowest (negative) correlation and the highest (positive) correlation. |
show.corr.values |
Logical; add the correlation values to the heatmap. |
print.corr.values |
Logical; If true, prints the correlation values. |
y.axis.label,ylab |
|
x.axis.label,xlab |
|
corr.text.size |
Size of the text that show the correlation values. |
This function takes two arguments, the x variables and the y variables, and generates a heatmap from the variables. A correlation matrix is computed from the data, melted (reshape package), and input into ggplot2 to generate a heatmap. The output is the correlations and the plot object.
Luke W. Johnston
1 2 3 4 5 6 7 8 9 10 | data(state)
plotHeatmapCorr(state.x77, c('Income', 'Population'), c('Frost', 'Murder'))
xvars <- c('Income', 'Population', 'Area', 'Frost')
## Replace Area with 'Land Area (km^2)', etc, on the axes using the gsub command
plotHeatmapCorr(state.x77, xvars, print.corr.values = TRUE,
x.name.sub = xvars %>%
gsub('Area', 'Land Area (km^2)', .) %>%
gsub('Income', 'Income ($)', .)
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.