Description Usage Arguments Details Value Source Examples
Calculates a correlation matrix for a dataset and display variables, as well as P-values in asteriks notation nicely. The function also writes the table into a LaTeX file if desired.
1 2 3 |
x |
A numeric matrix for which to compute the correlation matrix. |
y |
Optional second matrix. If omitted or |
method |
Method, i.e. Pearson's |
removeTriangle |
Parameter indicating whether to remove a duplicated triangle of the matrix. Defaul is the upper triangle that is removed. |
diagonale |
If |
digits |
Number of digits to be printed (default: 3). |
filename |
Path to which a LaTeX copy is exported (default is
|
To embed this correlation table inside LaTeX, requires a specific format as follows:
Insert the library SIunitx
inside the preamble of your
LaTeX document.
At the same location, define the following macro
\newcommand{\sym
[1]\rlap{$^{#1}$}}
Also in the preamble, change the sisetup
\sisetup{input-symbols={()*}}
Finally, choose S
as your column alignment.
Details: http://tex.stackexchange.com/questions/47418/siunitx-specifying-custom-command-as-input-symbol; also refer to the example in the README.
Correlation matrix with pretty output.
Idea: http://www.sthda.com/english/wiki/elegant-correlation-table-using-xtable-r-package
1 2 3 4 5 6 | data(USArrests)
correlationMatrix(USArrests)
# alternatively, with table exported into a LaTeX file
correlationMatrix(USArrests, filename = "table_cor.tex")
unlink("table_cor.tex")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.