我希望使用R语言计算不同发言人在一份文本中的发言行数(这是议会发言记录的转录稿)。原始文本如下:
MR. JOHN: This activity has been going on in Tororo and I took it up with the office of the DPC. He told me that he was not aware of it.
MS. SMITH: Yes, I am aware of that.
MR. LEHMAN: Therefore, I am seeking your guidance, Madam Speaker, and requesting that you re-assign the duty.
MR. JOHN: Thank you
在这份文件中,每个发言者都有一个以MR/MS开头的标识符,并且始终大写。我想创建一个数据集,计算每个发言者在文档中每次发言时所说的行数,使得上述文本的结果如下:
MR. JOHN: 2
MS. SMITH: 1
MR. LEHMAN: 2
MR. JOHN: 1
感谢使用R语言编程的技巧!