column2rownames: move columns/rows to col/rownames & back again

Description Usage Arguments Value Author(s)

Description

column2rownames, col2rownames: Move a column of x to the rownames and remove it from x

row2colnames: Move a row of x to the colnames and remove it from x

rownames2col,rownames2column: Move the rownames of x into a column

colnames2row: Move the colnames of x into a row.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
column2rownames(x, column = 1, sep = ".")

col2rownames(x, column = 1, sep = ".")

row2colnames(x, row = 1, sep = ".")

rownames2col(x, column = 1, colname = "")

rownames2column(x, column = 1, colname = "")

colnames2row(x, row = 1, rowname)

Arguments

x

a data.frame

column

the column index that the newly moved rownames will have - (ie column=1 puts the rownames into the first column). If column=NULL or column > ncol(x), the rownames will be moved to the first, and last column, respectively.

sep

the value to use to make the rownames unique (if necessary)

row

the row index that the newly moved colnames will have - (ie row=1 puts the colnames into the first row). If row=NULL or row > nrow(x), the colnames will be moved to the first, and last row, respectively.

colname

what name should the new column have? only gets set if there was a colname to begin with.

rowname

what name should the new row have? only gets set if there was a rowname to begin with.

Value

column2rownames, col2rownames: x with 1 less column and with rownames set

row2colnames: x with 1 less row and with colnames set

rownames2col,rownames2column: a data.frame with ncol(x) + 1 and the rownames in the extra column. The colclasses will be the same as they were in x, and the rownames will have the class of “character”.

colnames2row: a data.frame with nrow(x) + 1 and the colnames in the extra row. The rowclasses will be the same as they were in x, and the colnames will have the class of “character”.

Author(s)

Mark Cowley, 31 May 2006

Mark Cowley, 31 May 2006

Mark Cowley, 31 May 2006

Mark Cowley, 31 May 2006


drmjc/mjcbase documentation built on May 15, 2019, 2:27 p.m.