orderdata {HDTD}R Documentation

Reordering Row and Column Variables

Description

This utility function rearranges the row and/or the column variables in a desired order.

Usage

orderdata(datamat, N, order.rows = NULL, order.cols = NULL)

Arguments

datamat

numeric matrix containing the transposable data.

N

positive integer number indicating the sample size, i.e., the number of subjects.

order.rows

numeric vector displaying the desired order of the row variables.

order.cols

numeric vector displaying the desired order of the column variables.

Details

It is assumed that there are nrow(datamat) row variables and ncol(datamat)/N column variables in datamat. Further, datamat should be written in such a way that every ncol(datamat)/N consecutive columns belong to the same subject and the order of the column variables in each block is preserved across subjects.

Value

Returns a matrix of the same size as datamat.

Author(s)

Anestis Touloumis

See Also

meanmat.ts and meanmat.hat.

Examples

data(VEGFmouse)
set.seed(1)
tissuesold <-  colnames(VEGFmouse[ ,1:9])
## Suppose that you want to order the tissues in the folowing order.
tissuesnew <- colnames(VEGFmouse[ ,1:9])[sample(9)]
tissuesnew
## To do this, create a numeric vector with the desired order.
ordtis <- pmatch(tissuesnew, tissuesold)
VEGFmousenew <- orderdata(datamat = VEGFmouse, N = 40, order.cols = ordtis)
colnames(VEGFmousenew)[1:9]

[Package HDTD version 1.27.1 Index]