orderdata {HDTD} | R Documentation |
This utility function rearranges the row and/or the column variables in a desired order.
orderdata(datamat, N, order.rows = NULL, order.cols = NULL)
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. |
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.
Returns a matrix of the same size as datamat
.
Anestis Touloumis
meanmat.ts
and meanmat.hat
.
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]