Skip to content
Prev 82061 / 398506 Next

what is best for scripting?

As I get more familiar with R I tend to find the need for massaging data 
with other scripts decreasing.

I still use python as a front end to some R tasks and it is a great 
language to have in your personal arsenal (as is R).

The kind of decision making process for me goes something like:

	o If R can read the data directly then use R.  I am pleasantly 
surprised at R in this regard.

	o If Python (or other scripting tool) already has bindings for dataset 
that you want, consider using Python.  Eg I extract software development 
metrics from Perforce with python for plotting in R.

	o If the data set has a complex grammar, choose a tool with support for 
grammar compilers (I use and recommend pyparsing but there are dozens of 
choices).  Actually I didn't check if there is a grammar compiler for R. 
  Someone mentioned BeautifulSoup not long ago for extracting stuff from 
broken HTML.  I have used this also with some success for extracting 
deeply nested tables in poorly written HTML.

I usually dump data from Python to R in CSV format.  I call R scripts 
from Python and about the only trick I use here is to read in an R 
script template and perform string variable expansion (interpolation in 
Perl) before sending it to an R process.  See attached for example.  For 
various reasons I have not used the R-Python bindings.

cheers
Molins, Jordi wrote:
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: R.py
Url: https://stat.ethz.ch/pipermail/r-help/attachments/20051203/efa65ed2/R.pl