correlation_kim: Estimate the correlation between two variables

View source: R/correlation_kim.R

correlation_kimR Documentation

Estimate the correlation between two variables

Description

Estimate the correlation between two variables

Usage

correlation_kim(
  x = NULL,
  y = NULL,
  data = NULL,
  x_var_name = NULL,
  y_var_name = NULL,
  ci_range = 0.95,
  round_r = 2,
  round_p = 3,
  output_type = "summary"
)

Arguments

x

a numeric vector of data values

y

a numeric vector of data values

data

(optional) a data object (a data frame or a data.table)

x_var_name

(optional) name of the first variable (if using a data set as an input)

y_var_name

(optional) name of the second variable (if using a data set as an input)

ci_range

range of the confidence interval for the correlation coefficient. If ci_range = FALSE, no confidence interval will be estimated. By default, ci_range = 0.95.

round_r

number of decimal places to which to round correlation coefficients (default = 2)

round_p

number of decimal places to which to round p-values (default = 3)

output_type

type of the output. If output_type = "dt", the function's output will be a data.table with the results from the correlation analysis. If output_type = "summary", the function's output will be a statement (a string) summarizing the results from the correlation analysis. By default, output_type = "summary"

Examples

## Not run: 
correlation_kim(x = 1:4, y = c(1, 3, 2, 4))
correlation_kim(x = 1:4, y = c(1, 3, 2, 4), ci_range = FALSE)
# output as a data table
correlation_kim(x = 1:4, y = c(1, 3, 2, 4), output_type = "dt")

## End(Not run)

kim documentation built on Oct. 9, 2023, 5:08 p.m.