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

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

android - Keyboard hides my half of edit-text and button below it even in scroll view -