Description Usage Arguments Value Examples
Writes SVMLight sparse matrix file format. Requires Matrix and sparsio packages.
| 1 | sparse.write(file, x, y = numeric(nrow(x)), zero_based = TRUE)
 | 
| file | Type: character. Path to your SVMLight file. | 
| x | Type: any supported sparse matrix. The sparse matrix to write as SVMLight file format. Defaults to  | 
| y | Type: integer vector. The labels associated to the corresponding rows. | 
| zero_based | Type: logical. Whether columns are starting from  | 
TRUE when the function returns.
| 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")
sparse.write(file = temp_file, x = sparse_matrix, y = rep(1, ncol(sparse_matrix)))
sparse_matrix_read <- sparsio::read_svmlight(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.