View source: R/api_converters.R
as_sparta | R Documentation |
Turn an array-like object or a data.frame into a sparse representation
as_sparta(x) ## S3 method for class 'array' as_sparta(x) ## S3 method for class 'matrix' as_sparta(x) ## S3 method for class 'table' as_sparta(x) ## S3 method for class 'sparta' as_sparta(x) ## S3 method for class 'data.frame' as_sparta(x)
x |
array-like object or a data.frame |
A sparta object
as_array
# ---------- # Example 1) # ---------- x <- array( c(1,0,0,2,3,4,0,0), dim = c(2,2,2), dimnames = list( a = c("a1", "a2"), b = c("b1", "b2"), c = c("c1", "c2") ) ) as_sparta(x) # ---------- # Example 2) # ---------- y <- mtcars[, c("gear", "carb")] y[] <- lapply(y, as.character) as_sparta(y)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.