我有一个由Tweets(只是消息文本)组成的向量,我正在清理这些向量以用于文本挖掘。我removePunctuation从这样的tm包中使用过:
clean_tweet_text = removePunctuation(tweet_text)
Run Code Online (Sandbox Code Playgroud)
这样就产生了一个矢量,除了撇号外,所有标点符号都从文本中删除了,因为没有注册带有撇号的单词,这破坏了我的关键字搜索。例如,我的一个关键字是,climate但是如果有一条推文'climate,则不会被计算在内。
如何删除向量中所有的撇号/单引号?
这是dput可复制示例的标头:
c("expert briefing on climatechange disarmament sdgs nmun httpstco5gqkngpkap",
"who uses nasa earth science data he looks at impact of aerosols on climateamp weather httpstcof4azsiqkw1 https…",
"rt oddly enough some republicans think climate change is real oddly enough… httpstcomtlfx1mnuf uniteblue https…",
"better dead than red bill gates says that only socialism can save us from climate change httpstcopypqmd1fok",
"i see …Run Code Online (Sandbox Code Playgroud) 我想对数据框进行分组Participant并迭代地应用一个简单的线性模型公式lm(Outcome ~ A, data = mydata),以便最终得到一个新的单独的数据框,每个数据框具有一个系数Participant。
这是以下示例mydata:
structure(list(Participant = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6,
6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, …Run Code Online (Sandbox Code Playgroud)