joining multiple lines into one

Screenshots are all but useless, although this one is unusually legible. The better way to illustrate the problem is with a a reprex. See the FAQ.

As near as I can make out, these are lines that do not begin with an identifier such as R17. That, with rle() can probably be adapted to the purpose.