假设我在下面有一个字符串列表:
a <- c("the quick brown fox PST went", "jump over the lazy dog PST the end", "my name is john smith PST and your", "name is Jane Doe PST the end")
a <- data.frame(a)
并且我想创建一个新列,该列会在单词“ PST”之前截断每个字符串,因此输出将如下所示:
"the quick brown fox", "jump over the lazy dog", "my name is john smith", "name is Jane Doe"
如何使用R执行此操作,建议使用R中的哪个函数/包?