read.matrix.csr(file, fac = TRUE, ncol = NULL)
write.matrix.csr(x, file = "out.dat", y = NULL)
matrix.csr
TRUE
and y-values are stored in the file, the
values are interpreted as factor levels.read.matrix.csr
returns an object of class
matrix.csr
, else a list with components:matrix.csr
fac
.matrix.csr
library(methods)
if (require(SparseM)) {
data(iris)
x <- as.matrix(iris[,1:4])
y <- iris[,5]
xs <- as.matrix.csr(x)
write.matrix.csr(xs, y = y, file="iris.dat")
xs2 <- read.matrix.csr("iris.dat")$x
if (!all(as.matrix(xs) == as.matrix(xs2)))
stop("Error: objects are not equal!")
}
Run the code above in your browser using DataLab