[R-SIG-Mac] R.app cannot see tar but R (console) can
Prof Brian Ripley
ripley at stats.ox.ac.uk
Mon Aug 1 08:27:50 CEST 2011
And R itself (on any Unix-alike) sets the standard environment
variable TAR, so why not simply use it, e.g.
system2(Sys.getenv("TAR"), <character vector of args>))
Or use utils::untar etc.
On Mon, 1 Aug 2011, Berend Hasselman wrote:
>
> On 01-08-2011, at 06:15, <Ross.Darnell at csiro.au> <Ross.Darnell at csiro.au> wrote:
>
>> If I run
>>
>>> system('tar')
>> within the console version of R I get
>>
>>> system('tar')
>> tar: Must specify one of -c, -r, -t, -u, -x
>>
>> If I try using R.app I get
>>
>> R version 2.13.1 (2011-07-08)
>> Copyright (C) 2011 The R Foundation for Statistical Computing
>> ISBN 3-900051-07-0
>> Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)
>>
>> R is free software and comes with ABSOLUTELY NO WARRANTY.
>> You are welcome to redistribute it under certain conditions.
>> Type 'license()' or 'licence()' for distribution details.
>>
>> Natural language support but running in an English locale
>>
>> R is a collaborative project with many contributors.
>> Type 'contributors()' for more information and
>> 'citation()' on how to cite R or R packages in publications.
>>
>> Type 'demo()' for some demos, 'help()' for on-line help, or
>> 'help.start()' for an HTML browser interface to help.
>> Type 'q()' to quit R.
>>
>> [R.app GUI 1.41 (5874) x86_64-apple-darwin9.8.0]
>>
>> [Workspace restored from /Users/dar143/.RData]
>> [History restored from /Users/dar143/.Rapp.history]
>>
>>> system(tar)
>> Error in system(tar) : non-empty character argument expected
>
> 1. You should have done system("tar"). Now R is looking for an object tar which is empty.
>
> 2. GUI applications in Mac OS X don't inherit/receive the environment used in Terminal.
>
> You can check this in R.app with Sys.getenv("PATH").
> You could use Sys.setenv(PATH="...") in R.app to set PATH for that session.
>
> If you want GUI applications to always receive certain environment variables then see
>
> http://stackoverflow.com/questions/135688/setting-environment-variables-in-os-x
> http://developer.apple.com/library/mac/#qa/qa1067/_index.html
> http://developer.apple.com/library/mac/#documentation/MacOSX/Conceptual/BPRuntimeConfig/Articles/EnvironmentVars.html
>
> If you would like to set environment variables for GUI applications in a "nice" way (would also work for Emacs I think) you can use RCenvironment which provides a preference pane for setting environment variables for GUI applications. See
>
> http://www.rubicode.com/Software/RCEnvironment/
>
> best
>
> Berend
> _______________________________________________
> R-SIG-Mac mailing list
> R-SIG-Mac at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-SIG-Mac
mailing list