I have a string where I would like to extract spells from a sequence for example,
A<- c('000001111000', '0110011', '110001')
I would like to get the continuous spell lengths of 0 and 1 in a sequence format. Then using the lengths of the spells I would like to calculate the descriptive statistics like mean, mode, sd etc., (spell_0 and spell_1 are the sequences from the A vector.
For example,
spell_0 spell_1 mean_spell_0 mean_spell_1
5-3 4 4 4
1-2 2-2 1.5 2
3 2-1 3 1.5
Any suggestions?