Question:
I need to copy numbers between two text strings in column, “transpose” it to columns next to the first text string and repeat through the rest of the column. Dataset has hundreds of rows.The “alignment” (like putting NAs for correcting positions of numbers) is not necessary, transposing would be more than enough.
input:
But did not make much progress :-/
Thanks in advance.
Answer:
Split on a regex-based logical:(I defined the break points based on the presence of capital letters (i.e.
[A-Z]
); you may want to modify the pattern based on your expected break points in df1$column1
.)If you have better answer, please add a comment about this, thank you!