Tuesday 3 November 2015

setting up lyx/knitr/R for windows

New job at Glasgow doing Leukaemia research.

Currently having to use Windows for bioinformatics, which is always a pleasure.

I like to keep a running labbook in lyx, so that results / graphs from R can be automatically imported etc.

Installed R(v3.2.2, x86_64-w64-mingw32;  on 3/11/2015) and installed a few packages:
install.packages('ggplot2')
source('https://bioconductor.org/biocLite.R')
biocLite()
biocLite('ggbio')
install.packages('knitr')

Downloaded the Lyx 2.1.4 bundle (that installs MikTex at the same time) from ftp://ftp.lyx.org/pub/lyx/bin/2.1.4/LyX-2.1.4-Bundle-4.exe

In Lyx, I added the path to the directory containing 'Rscript.exe' for the above version of R to 'Preferences>Paths>PATH prefix', reconfigured Lyx.
On reopening Lyx, I was able to add the 'Rnw(knitr)' module to a blank document and compile a lyx document to pdf (the document contained no knitr markup).
But, within the drop-down menu that you use to tell Lyx the paragraph type that you want to use, there is supposed to be an option to add a 'Sweave/Chunk': this was absent in Lyx 2.1.4

I installed Lyx 2.0.8 using the installer: ftp://ftp.lyx.org/pub/lyx/bin/2.0.8/LyX-2.0.8-Installer-1.exe (since MikTex had already been installed)

On setting the Rscript path and adding Rnw(knitr) to a Lyx document, I was now able to add Sweave 'Chunk's to my document.

# hopefully the last in the current run of 'boring software installation blogs'