How to simply download the latest installer and start with R:
a) Determine the latest version of Pandoc and grab the URL using the XML package:
library(XML) page <- readLines('http://code.google.com/p/pandoc/downloads/list', warn = FALSE) pagetree <- htmlTreeParse(page, error=function(...){}, useInternalNodes = TRUE, encoding='UTF-8') url <- xpathSApply(pagetree, '//tr[2]//td[1]//a ', xmlAttrs)[1] url <- paste('http', url, sep = ':')
b) Or apply some regexp magic thanks to @ G.Grothendieck instead (no XML package needed this way):
page <- readLines('http://code.google.com/p/pandoc/downloads/list', warn = FALSE) pat <- "//pandoc.googlecode.com/files/pandoc-[0-9.]+-setup.exe" line <- grep(pat, page, value = TRUE); m <- regexpr(pat, line) url <- paste('http', regmatches(line, m), sep = ':')
c) Or just check the latest version manually if you want:
url <- 'http://pandoc.googlecode.com/files/pandoc-1.10.1-setup.exe'
Download the file as binary :
t <- tempfile(fileext = '.exe') download.file(url, t, mode = 'wb')
And just run it from R:
system(t)
Delete the unnecessary file after installation:
unlink(t)
PS: sorry, only tested on Windows XP
daroczig
source share