Learn R Programming

dtables (version 0.2.0)

cor_test: Correlation tests

Description

A wrapper for cor.test that returns data in a data.frame rather than a cumbersome list

Usage

cor_test(var1, var2, method = NULL, round = TRUE)

Arguments

var1
a vector to correlate with var2
var2
a vector to correlate with var1
method
the correlation method to use, either pearson, spearman, or kendall
round
logical, whether or not to round the results

Value

Returns a data.frame version of the standard htest output. Use intended for presentation of data because numbers are converted to character and then back to numeric, trimming each values length and costing you precision.

Examples

Run this code
cor_test(sample(1:100, 100), sample(1:100, 100), method = "pearson")

Run the code above in your browser using DataLab