Install pgfSweave in R 3.0.1

One of the programs I really (used to) depend on, pgfSweave, was unfortunately removed from CRAN about a year ago. Since then it is a bit of a hassle to keep it installed. Here are the steps necessary to install it under R 3.0.1 Good Sport.

For new projects, I recommmend knitr instead of pgfSweave. This page is for projects that you don't want to change.

1 Install formatR version 0.7

pgfSweave depends on formatR for the function deparse.tidy(). However, version 0.8 of formatR no longer exports deparse.tidy(). Therefore, you must install version 0.7 before you install pgfSweave.

download.file(
  "http://cran.r-project.org/src/contrib/Archive/formatR/formatR_0.7.tar.gz",
  "formatR"
)
install.packages("formatR", repos = NULL, type = "source")

If you still use R 2.15.1, then you also have to install archived versions of highlight and parser:

download.file(
  "http://cran.r-project.org/src/contrib/Archive/highlight/highlight_0.3.2.tar.gz",
  "highlight"
)
install.packages("highlight", repos = NULL, type = "source")

download.file(
  "http://cran.r-project.org/src/contrib/Archive/parser/parser_0.1.tar.gz",
  "parser"
)
install.packages("parser", repos = NULL, type = "source")

2 Install tikzDevice 0.6.3 (or higher)

install.packages('tikzDevice', repos='http://r-forge.r-project.org' )

3 Install and load devtools

In order to install R packages directly from github, you need the package devtool, which in turn depends on Rcurl, which in turn depends on libcurl4-gnutls-dev (or libcurl4-openssl-dev).

apt-get install libcurl4-gnutls-dev
install.packages('RCurl')
install.packages('devtools')
library(devtools)
apt-get --purge remove libcurl4-gnutls-dev

4 Install pgfSweave

## Either
install_github('pgfSweave','cameronbracken')

## Or
download.file(
  "http://cran.r-project.org/src/contrib/Archive/pgfSweave/pgfSweave_1.2.1.tar.gz",
  "pgfSweave"
)
install.packages("pgfSweave", repos = NULL, type = "source")

comments powered by Disqus


Back to the index

Blog roll

R-bloggers, Debian Weekly
Valid XHTML 1.0 Strict [Valid RSS] Valid CSS! Emacs Muse Last modified: oktober 12, 2017