coerce-vector | R Documentation |
Takes a numeric vector, integer or double, and turn it into a sparse double vector.
as_sparse_double(x, default = 0)
as_sparse_integer(x, default = 0L)
as_sparse_character(x, default = "")
as_sparse_logical(x, default = FALSE)
x |
a numeric vector. |
default |
default value to use. Defaults to The values of |
sparse vectors
x_dense <- c(3, 0, 2, 0, 0, 0, 4, 0, 0, 0)
x_sparse <- as_sparse_double(x_dense)
x_sparse
is_sparse_double(x_sparse)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.