correlationTable.cgPairedDifferenceData {cg}R Documentation

Compute Correlations from a cgPairedDifferenceData object

Description

Create a table of correlations of the data in a cgPairedDifferenceData object.

Usage

## S4 method for signature 'cgPairedDifferenceData'
correlationTable(data, display = "print", ...)

Arguments

data

A cgPairedDifferenceData object, typically created by prepareCGPairedDifferenceData.

display

One of three valid values:

"print"

The default value; It calls a print method for the created correlationTable object, which is a formatted text output of the table.

"none"

Supresses any printing. Useful, for example, when just assignment of the resulting object is desired.

"show"

Calls the default showDefault method, which will just print out the cgPairedDifferenceData object components.

...

Additional arguments. Currently only one is valid:

logscale

A logical value, indicating whether the correlation of the log transformed data should be calculated. If logscale is not specified, its value is taken from the cgPairedDifferenceData object, which prepareCGPairedDifferenceData sets from its logscale argument.

Details

The returned table contains correlations between the paired samples. The Pearson and Spearman methods are applied with the cor.test function from the core stats package. If the logscale option is specified (either explicitly, or implicitly from the cgPairedDifferenceData object), then the Pearson calculation on the log transformed data is added.

Value

Creates an object of class cgPairedDifferenceCorrelationTable, with the following slots:

contents

The table of correlations for the paired differences. See below for the data frame structure of the table.

settings

A list of settings carried from the cgPairedDifferenceData data object. These are used for the print.cgPairedDifferenceCorrelationTable method, invoked for example when display="print".

The data frame structure of the correlation table in a contents slot consists of row.names that specify the correlation method: Pearson, and Spearman if original (i.e. logscale=FALSE), and Pearson Original, Pearson Log, and Spearman if logscale=TRUE. The header label for the column of calculated correlations is correlation.

Note

Contact cg@billpikounis.net for bug reports, questions, concerns, and comments.

Author(s)

Bill Pikounis [aut, cre, cph], John Oleynick [aut], Eva Ye [ctb]

Examples

data(anorexiaFT)
anorexiaFT.data <- prepareCGPairedDifferenceData(anorexiaFT, format="groupcolumns",
                                                 analysisname="Anorexia FT",
                                                 endptname="Weight",
                                                 endptunits="lbs",
                                                 expunitname="Patient",
                                                 digits=1, logscale=TRUE)

correlationTable(anorexiaFT.data)

## Show only correlations computed on original scale
correlationTable(anorexiaFT.data, logscale=FALSE)



[Package cg version 1.0-3 Index]