craigcitro / r-travis

Tools for using R with Travis (http://travis-ci.org) in lieu of a website:

Home Page:https://github.com/craigcitro/r-travis/wiki

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Extending r-travis to run individual R scripts

baogorek opened this issue · comments

My first test with r-travis consisted of the file hello.R, which contained only the statement:

print("Hello, I'm R")

When r-travis spun up, there was an error because there was no DESCRIPTION file, i.e., hello.R was not an R package.

I believe supporting individual R script builds would be worthwhile. Imagine an R script that loads (1) a pre-built model from an .RData file and (2) a package from CRAN that contains a scoring function for the model object. Afterwards, say that the script pulls data from a web server based on an update notification, generates scores using the statistical model in memory, and post the scores on a webpage for consumption.

I think you're almost always better off using a package - it's just a simple set of conventions for organising your files and providing metadata. If you don't use a package, you're going to have to reinvent all of those conventions yourself (e.g. how can you tell what packages your code needs?)

that sounds pretty reasonable.

@baogorek I think in .travis.yml you can just run Rscript hello.R instead of the package check, and that will work fine.