CGIwithR package

Latest Version: 0.74-0

Download: CGIwithR.tar.gz

on github

This package allows one to use R scripts as CGI programs for generating dynamic Web content. HTML forms and other mechanisms to submit dynamic requests can be used to provide input to R scripts via the Web to create content that is determined within that R script. Recent changes (May 2014) provide support for handling large amounts of data in a POST submission. via a different CGI handler Rbigpost.cgi.

The latest version introduces some slight user-level incompatibilities from the previous version. Specifically, if multiple values are submitted for a parameter (e.g. two or more checkbox elements are selected in an HTML form), the corresponding formData element is a character vector containing all of these values, not just the first. This makes it easier to access them all. The original mechanism is still available and can be selected when the package is installed via the flag --enable-old-style-formdata for the configure script. One can do this with a command such as

  R CMD INSTALL --configure-args='--enable-old-style-formdata' CGIwithR_0.72.tar.gz

Origins of the Package

The package was originally written by David Firth at the University of Oxford and now at the University of Warwick. In November '05, Duncan Temple Lang extended it, primarily to handle multipart/form-data POST submissions. I (DTL) am responsible for the package now, but David deserves the credit for the package.


  • JSS paper CGIwithR: Facilities for processing Web forms using R
  • David's paper in JSS on CGIwithR. Citation. CGIwithR: Facilities for processing Web forms using R. Journal of Statistical Software, 8(10), pp. 1-8, 2003.
  • David's original CGIwithR page
  • A lecture on aspects of using CGI
  • An introduction to the basic architecture of forms and CGI scripts, and using CGIwithR. This includes some suggestions on how to debug R CGI scripts.
  • Examples
  • Some examples of HTML forms and corresponding R scripts. These cover GET and POST and multipart/form-data submissions.
  • Recent Changes
  • FAQ

  • Duncan Temple Lang <>
    Last modified: Fri May 30 2014