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"))
dfm(mycorpus, dictionary=mydict)
# import the Laver-Garry dictionary from http://bit.ly/1FH2nvf
lgdict <- dictionary(file="http://www.kenbenoit.net/courses/essex2014qta/LaverGarry.cat",
format="wordstat")
dfm(inaugTexts, dictionary=lgdict)
# import a LIWC formatted dictionary from http://www.moralfoundations.org
mfdict <- dictionary(file = "http://ow.ly/VMRkL", format = "LIWC")
dfm(inaugTexts, dictionary = mfdict)
Run the code above in your browser using DataLab