I have observations that are formed using Run Length Encoding
transform
as Example
set.seed(1)
make_data <- function() {
series <- rnorm(sample(10:50,1)) |> cumsum() |> sign()
accelerometry::rle2(series,indices = T)
}
my_obs <- lapply(1:5,\(x) make_data())
names(my_obs) <- paste("observation", 1:length(my_obs))
..
my_obs
$`observation 1`
value start stop length
[1,] -1 1 3 3
[2,] 1 4 5 2
[3,] -1 6 6 1
[4,] 1 7 30 24
$`observation 2`
value start stop length
[1,] 1 1 5 5
[2,] -1 6 8 3
[3,] 1 9 30 22
$`observation 3`
value start stop length
[1,] 1 1 30 30
$`observation 4`
value start stop length
[1,] -1 1 1 1
[2,] 1 2 12 11
[3,] -1 13 15 3
[4,] 1 16 30 15
$`observation 5`
value start stop length
[1,] -1 1 1 1
[2,] 1 2 9 8
[3,] -1 10 30 21
How can I convert this data into a regular table view (dataset) where each observation
is a row.
How to do it correctly without losing information?
Who does not know what Run Length Encoding
is, please read
?rle
?accelerometry::rle2