r - find out word frequency in a table according to a list -


now have dtm, turn dtm frequency table

freqs <- as.data.frame(inspect(dtm1)) 

here's how freqs looks like, contains 1 row shows frequency of these words in document

i      hate   school   how   can    hi 4      5        3       2      3     1    4    5   1 

i have list

list <- c("hi", "how", "are", "you") 

how can find out frequency of words in frequency table according list, compile these word frequencies in table

hi  how   1    3    4   5 

if words variable names in data.frame

> freqs[,list]   hi how 1  1   3   4   5 

Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

Cross-Compiling Linux Kernel for Raspberry Pi - ${CCPREFIX}gcc -v does not work -

java.lang.NoClassDefFoundError When Creating New Android Project -