Learn R Programming

specmine (version 1.0)

correlation_test: Correlation test of two variables or samples

Description

Performs correlations test of two variables or samples from the dataset.

Usage

correlation_test(dataset, x, y, method = "pearson", alternative = "two.sided", by.var = T)

Arguments

dataset
list representing the dataset from a metabolomics experiment.
x
first variable or sample.
y
second variable or sample.
method
correlation method, it can be "pearson", "kendall" or "spearman".
alternative
alternative argument from cor.test of stats package. Can be "two.sided", "less" or "greater".
by.var
if TRUE then the correlations of the variables will be calculated, if not then the correlations of the samples will be calculated.

Value

Returns the correlation result from cor.test function of stats package.

Examples

Run this code
  ## Example of correlations test of variables
  data(cachexia)
  corr.result = correlation_test(cachexia, "Serine", "Creatine", method = "pearson", 
		by.var = TRUE)

Run the code above in your browser using DataLab