(x <- data.frame(V1=sample.int(3,30,replace=TRUE),
V2=sample.int(2,30,replace=TRUE),
V3=sample.int(4,30,replace=TRUE)))
(c <- compress_rows(x))
stopifnot(all(decompress_rows(c)==x))
Run the code above in your browser using DataLab