| wordcount | R Documentation |
The function takes a text file or text string and outputs a barplot of the most frequently occuring words.
wordcount(file = "", n, decreasing = TRUE, text)
file |
A text file whose location is interpreted relative to the current working directory (given by |
n |
The number of words to show in the |
decreasing |
If |
text |
If you wish to enter text as an inline argument rather than as a file on your computer, you can enter your text as this argument and leave |
Jonathan Schwartz
scan,
barplot
myfile <- file.path(tempdir(), "wordcounttest.txt")
write("Four four four four. Three three three. Two two. One.",file=myfile )
wordcount(myfile ,4)
##or text can be entered inline
wordcount(text="Four four four four. Three three three. Two two. One.",n=4)