Learn R Programming

bigstep (version 0.5.0)

transposeBigMatrix: Transpose a big matrix

Description

Transpose a big matrix and write to a file.

Usage

transposeBigMatrix(X, file.out = "Xtrans.txt", ord = NULL, sep = "\t", type = "char", row.names = TRUE, maxp = 1e+07, verbose = TRUE, ...)

Arguments

X
an object of class big.matrix. The rows of X contain the observed variables, the columns of X contain samples.
file.out
a character string. The name of the output file.
ord
a numeric vector. The order in which new variables will be written (the size of ord can be smaller than X if you do not want to write some variables).
sep
a character, the field delimiter.
type
a character string. The type of data. Set NA if you do not know (but preferably specified).
row.names
a logical. If TRUE, the first column contains the row names.
maxp
a numeric. If X is big, it will be splitted into parts with maxp elements. It will not change results, but it is necessary if your computer does not have enough RAM. Set to a lower value if you still have problems.
verbose
a logical. Set FALSE if you do not want to see any information during the selection procedure.
...
further arguments passed to read.big.matrix.

Value

A numeric, a number of variables successfully written.

Examples

Run this code
## Not run: 
# data <- matrix(sample(0:2, 20, replace=T), 2, 10)
# rownames(data) <- c("X1", "X2")
# write.table(data, "X.txt", col.names=FALSE)
# X <- read.big.matrix("X.txt", sep=" ", type="char", has.row.names=TRUE)
# # if it is possible, set type="char", reading will be quicker
# transposeBigMatrix(X, sep=" ")
# ## End(Not run)

Run the code above in your browser using DataLab