EVOLUTION-MANAGER
Edit File: read.matrix.csr.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Read/Write Sparse Data</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for read.matrix.csr {e1071}"><tr><td>read.matrix.csr {e1071}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Read/Write Sparse Data</h2> <h3>Description</h3> <p>reads and writes a file in sparse data format. </p> <h3>Usage</h3> <pre> read.matrix.csr(file, fac = TRUE, ncol = NULL) write.matrix.csr(x, file = "out.dat", y = NULL, fac = TRUE) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x</code></td> <td> <p>An object of class <code>matrix.csr</code></p> </td></tr> <tr valign="top"><td><code>y</code></td> <td> <p>A vector (either numeric or a factor)</p> </td></tr> <tr valign="top"><td><code>file</code></td> <td> <p>The filename.</p> </td></tr> <tr valign="top"><td><code>fac</code></td> <td> <p>If <code>TRUE</code>, the y-values (if any) are interpreted as factor levels.</p> </td></tr> <tr valign="top"><td><code>ncol</code></td> <td> <p>Number of columns, detected automatically. Can be used to add empty columns (possibly not stored in the sparse format).</p> </td></tr> </table> <h3>Value</h3> <p>If the data file includes no y variable, <code>read.matrix.csr</code> returns an object of class <code>matrix.csr</code>, else a list with components: </p> <table summary="R valueblock"> <tr valign="top"><td><code>x</code></td> <td> <p>object of class <code>matrix.csr</code></p> </td></tr> <tr valign="top"><td><code>y</code></td> <td> <p>vector of numeric values or factor levels, depending on <code>fac</code>.</p> </td></tr> </table> <h3>Author(s)</h3> <p>David Meyer<br /> <a href="mailto:David.Meyer@R-project.org">David.Meyer@R-project.org</a> </p> <h3>See Also</h3> <p><code><a href="../../SparseM/html/matrix.csr.html">matrix.csr</a></code></p> <h3>Examples</h3> <pre> ## Not run: 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!") } ## End(Not run) </pre> <hr /><div style="text-align: center;">[Package <em>e1071</em> version 1.7-3 <a href="00Index.html">Index</a>]</div> </body></html>