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 -- Jonathan A. Greenberg, PhD Assistant Professor Global Environmental Analysis and Remote Sensing (GEARS) Laboratory Department of Geography and Geographic Information Science University of Illinois at Urbana-Champaign 259 Computing Applications Building, MC-150 605 East Springfield Avenue Champaign, IL 61820-6371 Phone: 217-300-1924 http://www.geog.illinois.edu/~jgrn/ AIM: jgrn307, MSN: jgrn307@hotmail.com, Gchat: jgrn307, Skype: jgrn3007 [[alternative HTML version deleted]]
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! > > --jSee 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
On 30 October 2013 at 13:54, Jonathan Greenberg 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! Up to you as you control the path. As "Writing R Extensions" explains, everything below the (source) directory inst/ will get installed. I like inst/extScripts/ (or similar) as it denotes that it is an external script. As an example, the gdata package has Perl code for xls reading/writing below a directory inst/perl/ -- and I think there are more packages doing this. Dirk -- Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com