I have a data frame with one column text as strings of interview transcripts between two people.
The format is firstname lastname m:ss then a line break, a paragraph of text, a line break, then firstname lastname m:ss a line break and a paragraph of text as below.
John Smith 2:03
Is this great?
Joe Blogs 2:24
Yes it is.
John Smith 2:35
Is it the greatest of all time?
Joe Blogs 2:47
Clearly.
I want to make 2 new strings to go in two new columns in my df. One for each person containing the paragraphs of text after their names strung together.
The interviewer in each of the text files is one of two people so I could match their name to assign them to an ‘interviewer”. I also have the interviewer name in an interviewer column of the df already.
Interviewer names: John Smith, Jane Doe
Desired Output:
| interviewer | subject |
|---|---|
| Is this great? Is it the greatest of all time? | Yes it is. Clearly. |
I'm not sure the best way to achieve what I am after. I've used tidyr extract to the interviewer, date etc. from the file names to put them into columns in my dataframe, but am not experienced enough to know how to use it to split the text like this - or if there's a better way to do it.