[R] How to do platform independent system calls?

Gerrit Eichner Gerrit.Eichner at math.uni-giessen.de
Tue Apr 2 12:38:47 CEST 2013


Hello, Anis,

can't say anything about your 1st question, but w.r.t. the 2nd

?file.path

should do what you want.

  Regards  --  Gerrit


On Tue, 2 Apr 2013, Asis Hallab wrote:

> Dear R experts,
>
> I hope everyone has had a happy easter break.
>
> Recently my work included writing R function that need to call external tools.
> I did this using R's system function for example:
>
> system( paste( 'tool', '-input', path_to_input, '-output',
> path_to_output, '-other_switch', some_val ) )
>
> I have two question about this:
>
> 1) Is there a way to implement such calls to external tools, so they
> become platform independent? I mean, so that these calls will work
> both on a *nix and a Windows system?
>
> 2) Is there a way to generate platform independent paths? So that
> "path/2/input.tbl" on *nix systems becomes "path\2\input.tbl" on a
> Windows system?
>
> Your help will be much appreciated!
> Kind regards!
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list