【发布时间】:2018-10-10 15:05:30
【问题描述】:
我正在做情绪分析,但我需要在每条推文中按 n char 进行过滤。我的意思是:
df <- c("the most beauty", "the most ugly", "you are beauty")
Library(dplyr)
df %>%
filter((n char >3) %in% df)
我期待这样的结果:“最美丽”、“丑陋”、“美丽”
我试过$str_detect,但没用
【问题讨论】:
-
df是vector,如示例中所示.. 你的意思是nchar(columnname)基于结果可能是sapply(strsplit(df, " "), function(x) paste(x[nchar(x) > 3], collapse= " "))
标签: r dplyr analysis sentiment-analysis