Encode using run-length encoding
Usage
encode(x, ...)
# S4 method for class 'Date'
encode(x)
# S4 method for class 'DFrame'
encode(x, j = NULL)
# S4 method for class 'Ranges'
encode(x)
# S4 method for class 'Rle'
encode(x)
# S4 method for class 'atomic'
encode(x)
# S4 method for class 'factor'
encode(x)
Examples
## DFrame ====
binary <- seq(from = 0L, to = 1L)
object <- S4Vectors::DataFrame(
"a" = rep(x = binary, times = 50L),
"b" = rep(x = binary, each = 50L)
)
lapply(object, class)
#> $a
#> [1] "integer"
#>
#> $b
#> [1] "integer"
#>
object <- encode(object)
lapply(object, class)
#> $a
#> [1] "Rle"
#> attr(,"package")
#> [1] "S4Vectors"
#>
#> $b
#> [1] "Rle"
#> attr(,"package")
#> [1] "S4Vectors"
#>