[英]time series analysis of text in r
如果我有这样的数据:
df = data.frame(person = c('jim','john','pam','jim'),
date =c('2018-01-01','2018-02-01','2018-03-01','2018-04-01'),
text = c('the lonely engineer','tax season is upon us, engineers, do your taxes!','i am so lonely','rage coding is the best') )
我想按日期了解趋势术语,该如何处理?
xCorp = corpus(df, text_field = 'text')
x = tokens(xCorp) %>% tokens_remove(
c(
stopwords('english'),
'western digital',
'wd',
'nil'),
padding = T
) %>%
dfm(
remove_numbers = TRUE,
remove_punct = TRUE,
remove_symbols = T,
concatenator = ' '
)
x2 = dfm(x, groups = 'date')
这会让我参与其中,但是不确定这是否是最好的方法。
使用tidyverse,我能够执行以下操作:
df = df %>%
group_by(date) %>%
unnest_tokens(word,text) %>%
count(word,sort = T) %>%
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.