[R] Vector of char generated by Sys.getenv function is not available when the package is loaded

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Sep 24 09:18:51 CEST 2013


On 24/09/2013 03:51, Jose Claudio Faria wrote:
> I think I found the main problem!
>
> I am developing the package under Linux and after R CMD build,
> manually compressing the folder TinnRcom inside of the folder
> TinnRcom.RCheck and installing in Windows.

And how on earth did you expect the helpers here to know that you were 
subverting the R installation procedures?

For a package without compiled code (as this must be for that to work) 
it really is very simple

R CMD build TinnRcom # on Linux
install.packages('TinnRcom_xx-x.tar.gz") # on Windows: no extra tools 
are needed.

> As the APPDATA environment variable does not exist in Linux, the
> function Sys.getenv ("APPDATA") is returning an empty string.
>
> I think the problem is it, now it is necessary to find a solution.
> Does anyone have a clue?

You really do not want to do this at install time (or the settings will 
be for the user who installs for source, Uwe Ligges for most Windows 
users).  Use .onLoad.

We write R manuals to explain this sort of thing:  fortunes::fortune(14) 
applies.

-- 
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-help mailing list