cor_test: Test for Correlation Between Paired Samples

View source: R/statistics-utils.R

cor_testR Documentation

Test for Correlation Between Paired Samples

Description

This function is a wrapper around stats::cor.test(). It implements the Pearson's correlation test that tests the null hypothesis that two paired samples of values are unrelated. This function must be applied to two numeric vectors.

Usage

cor_test(x, y, method = "pearson", data)

Arguments

x

A numeric variable.

y

A numeric variable.

method

A character string indicating which correlation coefficient is to be used: "pearson", "kendall", or "spearman". Default method is "pearson".

data

A data frame containing the y and x variables

Value

A tibble data frame with the correlation statistic, and the corresponding p-value.

Examples

cor_test(y = sex_dimorph, x = attractive, data = faithfulfaces)
cor_test(y = sex_dimorph, x = attractive, method = "spearman", data = faithfulfaces)

mark-andrews/psyntur documentation built on Nov. 18, 2024, 7:17 a.m.