Skip to contents

This function returns correlation coefficients for variables in one dataset against variables in a second dataset

Usage

correlation(
  data1,
  data2,
  method,
  format = c("ComputeResult", "data.table"),
  verbose = c(TRUE, FALSE),
  ...
)

Arguments

data1

first dataset. A data.table

data2

second dataset. A data.table

method

string defining the type of correlation to run. The currently supported values are specific to the class of data1 and data2.

format

string defining the desired format of the result. The currently supported values are 'data.table' and 'ComputeResult'.

verbose

boolean indicating if timed logging is desired

...

additional parameters

Value

data.frame with correlation coefficients or a ComputeResult object

Examples

diabImmune_genus <- getCollection(
     microbiomeData::DiabImmune, 
     "16S (V4) Genus (Relative taxonomic abundance analysis)", 
     continuousMetadataOnly = TRUE
)

correlationDT <- correlation(
     diabImmune_genus, 
     method = 'spearman', 
     format = 'data.table'
)
#> 
#> 2024-06-26 14:27:50.6956 Completed correlation with method=spearman. Formatting results.
#> 
#> 2024-06-26 14:27:50.696787 Received df table with 3184 samples and 138 features with values.

correlationOutput <- correlation(
     diabImmune_genus, 
     method = 'spearman', 
     format = 'ComputeResult'
)
#> 
#> 2024-06-26 14:27:54.590912 Completed correlation with method=spearman. Formatting results.
#> 
#> 2024-06-26 14:27:54.591803 Received df table with 3184 samples and 138 features with values.
#> 
#> 2024-06-26 14:27:54.593337 Correlation computation completed with parameters recordIdColumn= 16S_rRNA_(V4)_assay_Id , method =  spearman

alsoCorrelationDT <- getComputeResult(
     correlationOutput, 
     "data.table"
)