I/O Operations with Sparse Matrices

Fast 'SVMlight' reader and writer. 'SVMlight' is most commonly used format for storing sparse matrices (possibly with some target variable) on disk. For additional information about 'SVMlight' format see < http://svmlight.joachims.org/>.

sparsio is an R package for I/O operations with sparse matrices. At the moment it provides fast svmlight reader and writer.

  • read_svmlight()
  • write_svmlight()

The only dependency is Rcpp

Package is not on CRAN yet, so you can install it with devtools:


Quick reference

i = 1:8
j = 1:8
v = rep(2, 8)
x = sparseMatrix(i, j, x = v)
y = sample(c(0, 1), nrow(x), replace = TRUE)
f = tempfile(fileext = ".svmlight")
write_svmlight(x, y, f)
x2 = read_svmlight(f, type = "CsparseMatrix")
identical(x2$x, x)
identical(x2$y, y)


Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


1.0.1 by Dmitriy Selivanov, 2 years ago


Report a bug at https://github.com/dselivanov/sparsio/issues

Browse source code at https://github.com/cran/sparsio

Authors: Dmitriy Selivanov [aut, cre] , Felix Riedel [aut]

Documentation:   PDF Manual  

GPL (>= 2) | file LICENSE license

Imports Rcpp, Matrix

Depends on methods

Suggests testthat

Linking to Rcpp

See at CRAN