mycorpus <- subset(inaugCorpus, Year>1900)
mydict <- dictionary(list(christmas = c("Christmas", "Santa", "holiday"),
opposition = c("Opposition", "reject", "notincorpus"),
taxing = "taxing",
taxation = "taxation",
taxregex = "tax*",
country = "united states"))
head(dfm(mycorpus, dictionary = mydict))
## Not run:
# # import the Laver-Garry dictionary from http://bit.ly/1FH2nvf
# lgdict <- dictionary(file = "http://www.kenbenoit.net/courses/essex2014qta/LaverGarry.cat",
# format = "wordstat")
# head(dfm(inaugTexts, dictionary=lgdict))
#
# # import a LIWC formatted dictionary from http://www.moralfoundations.org
# mfdict <- dictionary(file = "http://ow.ly/VMRkL", format = "LIWC")
# head(dfm(inaugTexts, dictionary = mfdict))## End(Not run)
Run the code above in your browser using DataLab