Skip to content
PolMine edited this page Mar 16, 2017 · 25 revisions

Installation

System requirements

The polmineR package can be installed on:

  • Mac OS
  • Unix/Linux Systems
  • Windows (32bit R only)

Installation on Windows

The key dependency of the 'polmineR' package is the package 'rcqp'. A requirement for installing rcqp is the package plyr, which needs to be installed first.

install.packages("plyr")

Windows binaries for the rcqp package are not available at CRAN. Binaries can be installed from a so-called 'drat' repository at GitHub:

install.packages("rcqp", repos = "http://github.polmine.io/drat", type = "win.binary")

Explanation: Compiling the C code in the rcqp package on a windows machine is not possible directly. The package available at the 'drat' repository uses a cross-compilation of these C libraries, i.e. they have been prepared for windows on a MacOS/Linux machine.

Some packages are required for the polmineR installation that are not installed automatically.

install.packages(pkgs = c("htmltools", "htmlwidgets", "magrittr", "iterators", "NLP"))

The latest stable version of polmineR can then be installed from CRAN

install.packages("polmineR")

If you want to work with the development version, it can be installed from GitHub. The easiest way to do this, is to use a mechanism offered by the package devtools.

install.packages("devtools")
devtools::install_github("PolMine/polmineR", ref = "dev")

The installation may throw warnings. There are two types of warnings you can ignore:

  • The environment variable CORPUS_REGISTRY is not defined.
  • Error: package 'rcqp' is not installed for 'arch = x64'

As mentioned, windows binaries are not yet available for 64bit R at present. The environment variable "CORPUS_REGISTRY" can be set as follows in R:

Sys.setenv(CORPUS_REGISTRY = "C:/PATH/TO/YOUR/REGISTRY")

To set the environment variable CORPUS_REGISTRY permanently, see the instructions R offer how to find the file '.Renviron' or '.Renviron.site':

?Startup

One important note concerning the CORPUS_REGISTRY environment variable: The corpora on your system will not be found, if there is any whitespace in the path pointing to the registry. We do not yet know any workaround, it there is whitespace. In that case, please consider copying the files of the registry and the indexed_corpora to a directory without whitespace (a directory such as "C:/cwb").

Finally: polmineR uses the environment offered by the RStudio IDE, and working with RStudio is highly recommended. However, as polmineR is currently only available for 32bit R, you may have to check in the settings of RStudio that it will call 32bit R. Check the startup message. If everything works, check whether polmineR can be loaded.

library(polmineR)
corpus() # to see corpora available at your system

Dependencies

R-packages

  • rcqp (installation is a bit nasty)
  • xlsx
  • plyr
  • sendmailR

C libraries

other requirements

  • Java (for R-package xlsx)

Installation on Linux

If R is not yet installed, you can download R from the R website: http://www.R-Project.org Alternatively, you can install R via apt-get. As some packages may require a recent R version, make sure you have one of the R mirrors in your sources list first (see also https://cran.rstudio.com/bin/linux/ubuntu/).

sudo sh -c 'echo "deb https://cran.rstudio.com/bin/linux/ubuntu xenial/" >> /etc/apt/sources.list'
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9

Then install R:

sudo apt-get update
sudo apt-get install r-base r-base-dev

Using polmineR in the RStudio IDE is highly recommended. You can get RStudio either from the website of RStudio (https://www.rstudio.com), or do it in the terminal. Make sure that you get the most recent release!

sudo apt-get install gdebi-core
wget https://download1.rstudio.org/rstudio-1.0.44-amd64.deb
sudo gdebi -n rstudio-1.0.44-amd64.deb
rm rstudio-1.0.44-amd64.deb

The rcqp package is a crucial dependency of the polmineR package, and it requires a set of C libraries to be installed. The easiest way to install these libraries is to use the apt-get mechanism:

sudo apt-get install libglib2.0-0 libglib2.0-dev
sudo apt-get install libpcre3 libpcre3-dev
sudo apt-get install flex bison

Open R and install dependencies of rcqp, and finally rcqp:

install.packages(pkgs = c("RUnit", "plyr"))
install.packages("slam") # caution - the slam package may require R version 3.3.1 or higher
install.packages("tm")
install.packages("rcqp")

Now polmineR can be installed. To install the release available at CRAN:

install.packages("polmineR")

Development versions of the package are available at GitHub. You either clone the repo, or use the devtools-mechanism to install the package

install.packages("devtools") # if devtools is not yet installed
library(“devtools“)
devtools::install_github(„PolMine/polmineR“)

Installation on Mac

Before installing polmineR on Mac OS you need to install:

Reboot your Mac. After the reboot open the terminal again and install the Command Line Tool for Xcode:

xcode-select -- install

When Xcode has successfully updated go back to the terminal:

sudo port -v selfupdate
sudo port install glib2
sudo port install pkgconfig
sudo port install pcre

Open R, install dependencies and rcqp in the following order:

install.packages(“RUnit“)
install.packages(“devtools“)
install.packages(“plyr“)
install.packages(“tm“)
install.packages("rcqp")

Now polmineR can be installed. To install the development version, proceed as follows:

library(“devtools“)
devtools::install_github(„PolMine/polmineR“)