--- title: "Setup test" author: "Kenneth Benoit" date: "23 April 2017" output: html_document --- ```{r, echo = FALSE} knitr::opts_chunk$set( collapse = TRUE ) ``` #### Preliminaries: Installation First, you need to have **quanteda** installed. You can do this from inside RStudio, from the Tools...Install Packages menu, or simply using ```{r, eval = FALSE} install.packages("quanteda") ``` (Optional) You can install some additional corpus data from **quantedaData** using ```{r, eval=FALSE} ## the devtools package is required to install quanteda from Github devtools::install_github("quanteda/quanteda.corpora") ``` If you are feeling adventurous, you can install the latest build of **quanteda** from its [GitHub code page](https://github.com/kbenoit/quanteda). Note that on **Windows platforms**, it is also recommended that you install the [RTools suite](https://cran.r-project.org/bin/windows/Rtools/), and for **OS X**, that you install [XCode](https://itunes.apple.com/gb/app/xcode/id497799835?mt=12) from the App Store. #### Test your setup Run the rest of this file to test your setup. You must have quanteda installed in order for this next step to succeed. ```{r} require(quanteda) ``` Now summarize some texts in the Irish 2010 budget speech corpus: ```{r} summary(data_corpus_irishbudget2010) ``` Create a document-feature matrix from this corpus, removing stop words: ```{r} ieDfm <- dfm(data_corpus_irishbudget2010, remove = c(stopwords("english"), "will"), stem = TRUE) ``` Look at the top occuring features: ```{r} topfeatures(ieDfm) ``` Make a word cloud: ```{r, fig.width=8, fig.height=8} textplot_wordcloud(ieDfm, min.freq=25, random.order=FALSE) ``` If you got this far, congratulations!