Learn R Programming

RMThreshold (version 1.1)

rm.connections: Create ordered list of largest matrix elements

Description

The function creates a data frame which is sorted according to the (absolute) magnitude of the matrix elements.

Usage

rm.connections(mat, nr.list = 30, abs.val = TRUE, fn = NULL)

Arguments

mat
Input matrix.
nr.list
Number of matrix elements to show.
abs.val
Logical variable determining if absolute values should be used for sorting.
fn
A file name. If not NULL, the data frame is saved to that file.

Value

A data frame containing the values of the largest nr.list matrix elements, together with the respective row- and column numbers. If present, the referring row- and column names are also included.

Details

This function can for instance be useful if pairs of samples with the largest correlation/mutual information are to be identified. By default, the matrix elements are sorted according to their absolute values. The list will not be saved if no filename is invoked, otherwise it will be saved to a tab-separated text file.

Examples

Run this code

set.seed(777)
random.mat <- create.rand.mat(size = 1000, distrib = "norm")$rand.matr
dim(random.mat)

## After identification of a proper threshold:
cleaned.matrix <- rm.denoise.mat(random.mat, threshold = 3.2, keep.diag = TRUE)	
cl2.matrix = rm.discard.zeros(cleaned.matrix)				 
df = rm.connections(cl2.matrix)  

Run the code above in your browser using DataLab