From marc_schwartz at me.com  Wed Oct 30 20:15:19 2013
From: marc_schwartz at me.com (Marc Schwartz)
Date: Wed, 30 Oct 2013 14:15:19 -0500
Subject: [Rd] Where to drop a python script?
In-Reply-To: <CABG0rfvUzodJ6c22tU6E+yS_Z1NxieQE+afOAHZ4m+wvjcW2Dg@mail.gmail.com>
References: <CABG0rfvUzodJ6c22tU6E+yS_Z1NxieQE+afOAHZ4m+wvjcW2Dg@mail.gmail.com>
Message-ID: <7ABC1D6C-D5B1-4F5D-AE6C-7421BBCE6B49@me.com>


On Oct 30, 2013, at 1:54 PM, Jonathan Greenberg <jgrn at illinois.edu> wrote:

> R-developers:
> 
> I have a small python script that I'd like to include in an R package I'm
> developing, but I'm a bit unclear about which subfolder it should go in.  R
> will be calling the script via a system() call.  Thanks!
> 
> --j


See Writing R Extensions Manual, section 1.1.7:

  http://cran.r-project.org/doc/manuals/r-release/R-exts.html#Non_002dR-scripts-in-packages

If you want to see a package example, my WriteXLS package uses Perl, but the concepts will be the same:

  https://github.com/marcschwartz/WriteXLS

If you look at WriteXLS.R around line 130, you can see an example of getting the $PATH to the included Perl scripts that I use, which are in the 'inst/Perl' folder. Further down around line 230, is where the script is called via system(). Note the use of shQuote() for some arguments.

Regards,

Marc Schwartz



[Rd] Where to drop a python script?
Marc Schwartz