I have a large sequence of strings containing only the following characters
"M", "D", "A"
such as:
"M" "M" "A" "A" "D" "D" "M" "D" "A"
and I would like to compress it to:
M2A2D2M1D1A1
in R. Googling has led me to this (a java solution) but before implementing it, it would be interesting to check if I can find something ready online. Thanks!