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 - How to retrieve a variable from the Apache configuration inside the module? -

c# - Constructor arguments cannot be passed for interface mocks -

python - malformed header from script index.py Bad header -