Learn R Programming

pguIMP (version 0.0.0.3)

pgu.correlator: pgu.correlator

Description

An R6 class that performs pairwise correlation on the pguIMP data set.

Arguments

Format

R6::R6Class object.

Construction

x <- pguIMP::pgu.correlator$new()

Active bindings

featureNames

Returns the instance variable featureNames. (character)

setFeatureNames

Sets the instance variable featureNames. It further initializes the instance variables: intercept, pIntercept, slope, pSlope. (character)

method

Returns the instance variable method. (character)

r

Returns the instance variable r. (matrix)

pPearson

Returns the instance variable pPearson. (matrix)

tau

Returns the instance variable tau. (matrix)

pKendall

Returns the instance variable pKendall. (matrix)

rho

Returns the instance variable rho. (matrix)

pSpearman

Returns the instance variable pSpearman. (matrix)

abscissa

Returns the instance variable abscissa. (character)

setAbscissa

Sets the instance variable abscicca to value.

ordinate

Returns the instance variable ordinate. (character)

setOrdinate

Sets the instance variable ordinate to value.

test

Returns the instance variable test. (stats::cor.test)

Methods

Public methods

Method new()

Creates and returns a new pgu.correlator object.

Usage

pgu.correlator$new(data = "tbl_df")

Arguments

data

The data to be modeled. (tibble::tibble)

Returns

A new pgu.correlator object. (pguIMP::pgu.correlator)

Method finalize()

Clears the heap and indicates if instance of pgu.correlator is removed from heap.

Usage

pgu.correlator$finalize()

Method print()

Prints instance variables of a pgu.correlator object.

Usage

pgu.correlator$print()

Returns

string

Method resetCorrelator()

Performes pair-wise correlation analysis on the attributes of the data frame. Progresse is indicated by the progress object passed to the function.

Usage

pgu.correlator$resetCorrelator(data = "tbl_df", progress = "Progress")

Arguments

data

Dataframe with at least two numeric attributes. (tibble::tibble)

progress

Keeps track of the analysis progress. (shiny::Progress)

Method resetMatrix()

Creates a square matrix which dimension corresponds to the length of the instance variable featureNames. The matrix entries are set to a distict value.

Usage

pgu.correlator$resetMatrix(value = "numeric")

Arguments

value

The value the matrix entries are set to. (numeric)

Returns

A square matrix. (matrix)

Method featureIdx()

Determines the numerical index of the column of an attribute based on the attribute name.

Usage

pgu.correlator$featureIdx(feature = "character")

Arguments

feature

The attribute's name. (character)

Returns

The attributes column index. (numeric)

Method calcCorrelationNumeric()

Creates a correlation test between two attributes of a dataframe. The test is stored as instance variable.

Usage

pgu.correlator$calcCorrelationNumeric(
  abscissa = "numeric",
  ordinate = "numeric",
  method = "character"
)

Arguments

abscissa

The abscissa values. (numeric)

ordinate

The ordinate values. (numeric)

method

The cname of the correlation test. Valid coiced are defined by the instance variable method. (chatacter)

Method createCorrelationMatrixPearson()

Performs the actual correlation test routine after Pearson. Iteratively runs through the attributes known to the class and calculates Pearson's correlation for each valid attribute pair. The test results are stored in the instance variables: r, pPearson. Here, pX represents the p-value of the respective parameter X. Displays the progress if shiny is loaded.

Usage

pgu.correlator$createCorrelationMatrixPearson(
  data = "tbl_df",
  progress = "Progress"
)

Arguments

data

The data to be analysed. (tibble::tibble)

progress

If shiny is loaded, the analysis' progress is stored within this instance of the shiny Progress class. (shiny::Progress)

Method createCorrelationMatrixKendall()

Performs the actual correlation test routine after Kendall. Iteratively runs through the attributes known to the class and calculates Kendall's correlation for each valid attribute pair. The test results are stored in the instance variables: tau, pKendall. Here, pX represents the p-value of the respective parameter X. Displays the progress if shiny is loaded.

Usage

pgu.correlator$createCorrelationMatrixKendall(
  data = "tbl_df",
  progress = "Progress"
)

Arguments

data

The data to be analysed. (tibble::tibble)

progress

If shiny is loaded, the analysis' progress is stored within this instance of the shiny Progress class. (shiny::Progress)

Method createCorrelationMatrixSpearman()

Performs the actual correlation test routine after Spearman. Iteratively runs through the attributes known to the class and calculates Spearman's correlation for each valid attribute pair. The test results are stored in the instance variables: rho, pSpearman. Here, pX represents the p-value of the respective parameter X. Displays the progress if shiny is loaded.

Usage

pgu.correlator$createCorrelationMatrixSpearman(
  data = "tbl_df",
  progress = "Progress"
)

Arguments

data

The data to be analysed. (tibble::tibble)

progress

If shiny is loaded, the analysis' progress is stored within this instance of the shiny Progress class. (shiny::Progress)

Method correlate()

Performs the all three correlation test routines defined within the instance variable method. Displays the progress if shiny is loaded.

Usage

pgu.correlator$correlate(data = "tbl_df", progress = "Progress")

Arguments

data

The data to be analysed. (tibble::tibble)

progress

If shiny is loaded, the analysis' progress is stored within this instance of the shiny Progress class. (shiny::Progress)

Method printFeature()

Transforms the results of the correlation procedure for a valid pair of attributes to a dataframe and returns it.

Usage

pgu.correlator$printFeature()

Returns

The analyis result as a dataframe. (tibble::tibble)

Method printRTbl()

Transfroms instance variable r to a dataframe and returns it.

Usage

pgu.correlator$printRTbl()

Returns

Dataframe of instance variable r. (tibble::tibble)

Method printPPearsonTbl()

Transfroms instance variable pPearson to a dataframe and returns it.

Usage

pgu.correlator$printPPearsonTbl()

Returns

Dataframe of instance variable pPearson. (tibble::tibble)

Method printTauTbl()

Transfroms instance variable tau to a dataframe and returns it.

Usage

pgu.correlator$printTauTbl()

Returns

Dataframe of instance variable tau. (tibble::tibble)

Method printPKendallTbl()

Transfroms instance variable pKendall to a dataframe and returns it.

Usage

pgu.correlator$printPKendallTbl()

Returns

Dataframe of instance variable pKendall. (tibble::tibble)

Method printRhoTbl()

Transfroms instance variable rho to a dataframe and returns it.

Usage

pgu.correlator$printRhoTbl()

Returns

Dataframe of instance variable rho. (tibble::tibble)

Method printPSpearmanTbl()

Transfroms instance variable pSpearman to a dataframe and returns it.

Usage

pgu.correlator$printPSpearmanTbl()

Returns

Dataframe of instance variable pSpearman. (tibble::tibble)

Method clone()

The objects of this class are cloneable with this method.

Usage

pgu.correlator$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

Run this code
# NOT RUN {
require(dplyr)
require(tibble)
data(iris)
data_df <- iris %>%
  tibble::as_tibble() %>%
  dplyr::select(-c("Species"))
correlator = pguIMP::pgu.correlator$new(data_df)
# }

Run the code above in your browser using DataLab