[R] argv[0] --- again

Duncan Murdoch murdoch at stats.uwo.ca
Mon Apr 3 14:46:59 CEST 2006


On 4/3/2006 8:18 AM, ivo welch wrote:
> hi gabor:  thank you very much.  how do you know this stuff?  I just
> looked at the contributors() list, and you are not on it.  may I
> highly suggest that a wrapper for this become part of the R base?  it
> should also have a link from the commandArgs() help page to whatever
> this function should be called.

The suggestion is really good, but I don't think it belongs in the base 
packages.  It depends on too much: wmic on the path, only one BATCH job 
running at once.

On the other hand, putting something like this on the R Wiki, or in a 
package of misc tools, or elsewhere online seems like a really good idea.

Duncan Murdoch

> 
> regards,
> 
> /iaw
> 
> 
>> But you can still get it from the system. On XP Pro
>> (maybe other Windows systems too?) place this in a.r
>>
>> out <- system("wmic /output:stdout process", intern = TRUE)
>> out <- sapply(out, function(x) substr(x, 1, nchar(x)-1))
>> print(strsplit(grep("rcmd.exe.*batch", tolower(out), value = TRUE), "
>> *")[[1]][4])
>>
>> and then at the command line type:
>>
>> Rcmd BATCH a.r
>>
>> and it will print out a.r
>>




More information about the R-help mailing list