sortDatByNames: sort data.frame by colnames and/or rownames

Description Usage Arguments Value Author(s) Examples

Description

specify new colnames and/or rownames order, data.frame is sorted in accordance

Usage

1
sortDatByNames ( dat , col.order = NULL , row.order = NULL , warn = TRUE )

Arguments

dat

data.frame

col.order

character vector of colnames in new order

row.order

character vector of rownames in new order

warn

logical, if TRUE warnings are printed on output window if col.order/row.order do not correspond to colnames/rownames resp.

Value

data.frame

Author(s)

Martin Hecht

Examples

1
2
3
4
5
6
7
dat <- data.frame ( matrix ( rnorm ( 100 ) , ncol = 10 ) )
colnames ( dat ) <- paste ( "X" , 10:1 , sep = "" )
rownames ( dat ) <- paste ( "X" , 11:2 , sep = "" )
dat

# sort data.frame by 'col.order' and 'row.order'
sortDatByNames ( dat , paste ( "X" , 1:10 , sep = "" ) , paste ( "X" , 2:11 , sep = "" ) )

eatRest documentation built on May 2, 2019, 6:25 p.m.