我具有以下chr
数组
v<-c("RT @name1: hello world", "Hi guys, how are you?", "Hello RT I have no text", "RT @name2: Hello!")
我只想删除位于句子开头的RT
,并在另一个数组中写入w
,例如结果。例如:
> w
"@name1: hello world" "Hi guys, how are you?" "Hello RT I have no text" "@name2: Hello!"
也许我可以通过软件包str_extract_all
使用函数stringr
,但无法将其应用于我的问题。
<- str_replace(v,"^RT","")