| combineBigMatrices {bigstep} | R Documentation |
Combine and/or transpose big matrices and write to a file with new names of columns
combineBigMatrices(X, Z = NULL, file.out = "XZ.txt", transX = FALSE, transZ = FALSE, new.names = NULL, maxp = 1e+07, verbose = TRUE)
X |
an object of class big.matrix. |
Z |
an object of class big.matrix. Specify if you want to combine matrices. |
file.out |
a character string. The name of the output file. |
transX |
a logical. If |
transZ |
a logical. If |
new.names |
a vector of strings. Specify if you want to change names of variables. |
maxp |
a numeric. If |
verbose |
a logical. Set |
A numeric, a number of variables successfully written.
## Not run:
library(bigmemory)
X <- matrix(sample(0:2, 20, replace=TRUE), 2, 10)
Z <- matrix(sample(0:2, 20, replace=TRUE), 2, 10)
write.table(X, "X.txt", col.names=FALSE, row.names=FALSE)
write.table(Z, "Z.txt", col.names=FALSE, row.names=FALSE)
X <- read.big.matrix("X.txt", sep=" ", type="char")
Z <- read.big.matrix("Z.txt", sep=" ", type="char")
# if it is possible, set type="char", reading will be quicker
names <- c("X1", "X2", "Z1", "Z2")
combineBigMatrices(X, Z, transX=TRUE, transZ=TRUE, new.names=names)
## End(Not run)