I have a string that I've converted into a character vector:
string <- c("A","A","A","C","G","G","C","C","T","T","T","T")
I'd like to be able to output a table that shows the indices of the consecutive letters in the order they appear. for example:
letter start end
A 1 3
C 4 4
G 5 6
C 7 8
T 9 12
I've tried looking into str_locate
and some other str functions but haven't been able to figure it out. Any help appreciated!