I want to convert the information contained in the "rle" function in R to a dataframe, but couldn't find a way. For example, for a vector
x <- c(1,1,1,2,2,3,4,4,4)
I want the dataframe to have two columns 1 2 3 4
and3 2 1 3
Any help would be greatly appreciated!
source
to share