Description Usage Arguments Value Examples
Reads SVMLight sparse matrix file format. Requires Matrix
and sparsio
packages.
1 |
file |
Type: character. Path to your SVMLight file. |
type |
Type: character. The matrix output type, which can be |
zero_based |
Type: logical. Whether columns are starting from |
ncol |
Type: integer. The number of columns in the sparse matrix, useful in the case your data is very sparse and you already know the number of columns. |
The data from the SVMLight file.
1 2 3 4 5 6 | library(Matrix)
sparse_matrix <- sparseMatrix(i = 1:100, j = 1:100, x = 1:100)
temp_file <- tempfile(fileext = ".svm")
sparsio::write_svmlight(x = sparse_matrix, y = rep(1, ncol(sparse_matrix)), file = temp_file)
sparse_matrix_read <- sparse.read(temp_file)
identical(sparse_matrix, sparse_matrix_read$x)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.