Encode using run-length encoding

encode(x, ...)

# S4 method for DataFrame
encode(x)

# S4 method for GRanges
encode(x)

Arguments

x

Object.

...

Additional arguments.

Value

Modified object. All atomic columns will be encoded to Rle S4 class.

See also

Examples

binary <- seq(from = 0L, to = 1L) df <- S4Vectors::DataFrame( a = rep(x = binary, times = 50L), b = rep(x = binary, each = 50L) ) lapply(df, class)
#> $a #> [1] "integer" #> #> $b #> [1] "integer" #>
x <- encode(df) lapply(x, class)
#> $a #> [1] "Rle" #> attr(,"package") #> [1] "S4Vectors" #> #> $b #> [1] "Rle" #> attr(,"package") #> [1] "S4Vectors" #>