Description Usage Arguments Value Note See Also Examples
This function computes the Spearman correlation between two variables. It is
a simple wrapper around the R function cor.test, with better
display of the output.
1 | compute_correlation(var1, var2)
|
var1 |
A vector. |
var2 |
A vector. |
A vector containing the correlation between two variables, the p-value of the correlation test, and the sample size after discarding the missing values.
We set the argument exact to FALSE in the call to cor.test,
so that the presence of ties in some correlation tests would not change
how the p-values are computed (exact tests are not possible in the presence of ties for this implementation of
the test). Otherwise p-values obtained can sometimes be inconsistent across tests (ex: smaller p-values despite higher rho and same sample
size.)
1 | compute_correlation(var1 = males$Mat_succ, var2 = males$Rep_succ)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.