[Rd] Best way to locate R executable from within R?

2012-05-22 Thread Henrik Bengtsson
Hi, I'd like to spawn of a new R process from within R using system(), e.g. system(R -f myScript.R). However, just specifying R as in that example is not guaranteed to work, because R may not be on the OS's search path. What is the best way, from within a running R, to infer the command

Re: [Rd] Best way to locate R executable from within R?

2012-05-22 Thread Dan Tenenbaum
On Tue, May 22, 2012 at 10:34 AM, Henrik Bengtsson h...@biostat.ucsf.edu wrote: Hi, I'd like to spawn of a new R process from within R using system(), e.g. system(R -f myScript.R).  However, just specifying R as in that example is not guaranteed to work, because R may not be on the OS's

Re: [Rd] Best way to locate R executable from within R?

2012-05-22 Thread Henrik Bengtsson
On Tue, May 22, 2012 at 10:47 AM, Dan Tenenbaum dtene...@fhcrc.org wrote: On Tue, May 22, 2012 at 10:34 AM, Henrik Bengtsson h...@biostat.ucsf.edu wrote: Hi, I'd like to spawn of a new R process from within R using system(), e.g. system(R -f myScript.R).  However, just specifying R as in

Re: [Rd] Best way to locate R executable from within R?

2012-05-22 Thread Simon Urbanek
On May 22, 2012, at 1:47 PM, Dan Tenenbaum dtene...@fhcrc.org wrote: On Tue, May 22, 2012 at 10:34 AM, Henrik Bengtsson h...@biostat.ucsf.edu wrote: Hi, I'd like to spawn of a new R process from within R using system(), e.g. system(R -f myScript.R). However, just specifying R as in that

Re: [Rd] Best way to locate R executable from within R?

2012-05-22 Thread Gabor Grothendieck
On Tue, May 22, 2012 at 1:34 PM, Henrik Bengtsson h...@biostat.ucsf.edu wrote: Hi, I'd like to spawn of a new R process from within R using system(), e.g. system(R -f myScript.R).  However, just specifying R as in that example is not guaranteed to work, because R may not be on the OS's

Re: [Rd] Best way to locate R executable from within R?

2012-05-22 Thread Simon Urbanek
On May 22, 2012, at 2:39 PM, Gabor Grothendieck ggrothendi...@gmail.com wrote: On Tue, May 22, 2012 at 1:34 PM, Henrik Bengtsson h...@biostat.ucsf.edu wrote: Hi, I'd like to spawn of a new R process from within R using system(), e.g. system(R -f myScript.R). However, just specifying R

Re: [Rd] Best way to locate R executable from within R?

2012-05-22 Thread Henrik Bengtsson
On Tue, May 22, 2012 at 11:39 AM, Gabor Grothendieck ggrothendi...@gmail.com wrote: On Tue, May 22, 2012 at 1:34 PM, Henrik Bengtsson h...@biostat.ucsf.edu wrote: Hi, I'd like to spawn of a new R process from within R using system(), e.g. system(R -f myScript.R).  However, just specifying R

Re: [Rd] Best way to locate R executable from within R?

2012-05-22 Thread Gabor Grothendieck
On Tue, May 22, 2012 at 3:05 PM, Henrik Bengtsson h...@biostat.ucsf.edu wrote: On Tue, May 22, 2012 at 11:39 AM, Gabor Grothendieck ggrothendi...@gmail.com wrote: On Tue, May 22, 2012 at 1:34 PM, Henrik Bengtsson h...@biostat.ucsf.edu wrote: Hi, I'd like to spawn of a new R process from

Re: [Rd] Best way to locate R executable from within R?

2012-05-22 Thread Gabor Grothendieck
On Tue, May 22, 2012 at 3:28 PM, Gabor Grothendieck ggrothendi...@gmail.com wrote: On Tue, May 22, 2012 at 3:05 PM, Henrik Bengtsson h...@biostat.ucsf.edu wrote: On Tue, May 22, 2012 at 11:39 AM, Gabor Grothendieck ggrothendi...@gmail.com wrote: On Tue, May 22, 2012 at 1:34 PM, Henrik

Re: [Rd] Best way to locate R executable from within R?

2012-05-22 Thread Simon Urbanek
On May 22, 2012, at 3:34 PM, Gabor Grothendieck wrote: On Tue, May 22, 2012 at 3:28 PM, Gabor Grothendieck ggrothendi...@gmail.com wrote: On Tue, May 22, 2012 at 3:05 PM, Henrik Bengtsson h...@biostat.ucsf.edu wrote: On Tue, May 22, 2012 at 11:39 AM, Gabor Grothendieck

Re: [Rd] Best way to locate R executable from within R?

2012-05-22 Thread Simon Urbanek
I think the most reliable solution is something like system(paste(shQuote(file.path(R.home(bin),R)), ...)) it supports spaces in paths and works both on unix and Windows, picking the proper architecture. Cheers, Simon On May 22, 2012, at 3:05 PM, Henrik Bengtsson wrote: On Tue, May 22,

Re: [Rd] Best way to locate R executable from within R?

2012-05-22 Thread Gabor Grothendieck
On Tue, May 22, 2012 at 6:04 PM, Simon Urbanek simon.urba...@r-project.org wrote: On May 22, 2012, at 3:34 PM, Gabor Grothendieck wrote: On Tue, May 22, 2012 at 3:28 PM, Gabor Grothendieck ggrothendi...@gmail.com wrote: On Tue, May 22, 2012 at 3:05 PM, Henrik Bengtsson h...@biostat.ucsf.edu

Re: [Rd] Best way to locate R executable from within R?

2012-05-22 Thread Simon Urbanek
On May 22, 2012, at 7:37 PM, Gabor Grothendieck wrote: On Tue, May 22, 2012 at 6:04 PM, Simon Urbanek simon.urba...@r-project.org wrote: On May 22, 2012, at 3:34 PM, Gabor Grothendieck wrote: On Tue, May 22, 2012 at 3:28 PM, Gabor Grothendieck ggrothendi...@gmail.com wrote: On Tue, May

Re: [Rd] Best way to locate R executable from within R?

2012-05-22 Thread Gabor Grothendieck
On Tue, May 22, 2012 at 7:50 PM, Simon Urbanek simon.urba...@r-project.org wrote: On May 22, 2012, at 7:37 PM, Gabor Grothendieck wrote: On Tue, May 22, 2012 at 6:04 PM, Simon Urbanek simon.urba...@r-project.org wrote: On May 22, 2012, at 3:34 PM, Gabor Grothendieck wrote: On Tue, May 22,