Forum Discussion
maganstephens
9 years agoNew Member
word frequency
I have a bunch of text that I'm interested in seeing if there is a trend in the words used. Word Cloud is great but I can't figure out how to count the words and the frequency of each word after Word...
Phil_Seamark
9 years agoMicrosoft Employee
Hi maganstephens,
I think this is even better. Use the following R-Script in the Query Editor to add a column that will have the count of words in another column that contains the wordcount from another column
I used a basic table and the column that this counts is called Words
# 'dataset' holds the input data for this script
dataset = within(dataset , {WordCount= sapply(gregexpr("\\b\\W+\\b", Words, perl=TRUE), function(x) sum(x>0) ) + 1 })
output <- dataset