Here's the short answer:  Whatever you used to do should still work.

I started this thread, not knowing that it was going to get sucked into a whirlpool on the fringes of an operating system religious war. My sincerest apologies to everyone who has gotten confused as a consequence.

I only ran into problem because I installed R 3.0 and Rtools 3.0 on a new machine, and accidentally put Rtools in a different location from where it used to reside on the machines I used for R 2.whatever. And so the scripts I used to build packages no longer worked because the path was wrong. If you can avoid doing something silly like that, then your old methods for building and maintaining packages should work the same way they always did.

On 4/21/2013 8:22 PM, steven mosher wrote:
Well, color me confused as heck. I've upgraded to R 3.0 so that I can bring
my packages up to date, but the instructions surrounding Rtools30 are not a
model of clarity.


On Sun, Apr 21, 2013 at 4:04 PM, Gabor Grothendieck <ggrothendi...@gmail.com
wrote:
On Sun, Apr 21, 2013 at 6:17 PM, Henrik Bengtsson <h...@biostat.ucsf.edu>
wrote:
I (as well) keep a specific Rsetup.bat file for launching Windows
cmd.exe with the proper PATH etc setup for build R packages etc.  It's
only after this thread I gave it a second thought; you can indeed
temporarily set the PATH via ~/.Rprofile or ~/.Renviron, which *are*
processed at the very beginning when calling 'R CMD ...'.

EXAMPLE WITH .Rprofile:

## ~/.Rprofile (e.g. C:/User/foo/.Rprofile):
path <- unlist(strsplit(Sys.getenv("PATH"), ";"));
path <- c("C:\\Rtools\\bin", "C:\\Rtools\\gcc-4.6.3\\bin", path);
Sys.setenv("PATH"=paste(unique(path), collapse=";"));

## DISABLED:
x:\> R --no-init-file CMD INSTALL matrixStats_0.6.2.tar.gz
* installing to library 'C:/Users/hb/R/win-library/3.0'
* installing *source* package 'matrixStats' ...
** libs
*** arch - i386
ERROR: compilation failed for package 'matrixStats'
* removing 'C:/Users/hb/R/win-library/3.0/matrixStats'

## ENABLED:
x:\> R CMD INSTALL matrixStats_0.6.2.tar.gz
* installing to library 'C:/Users/hb/R/win-library/3.0'
* installing *source* package 'matrixStats' ...
** libs
*** arch - i386
gcc -m32 -I"C:/PROGRA~1/R/R-3.0.0patched/include" -DNDEBUG [...]
[...]
* DONE (matrixStats)


EXAMPLE WITH .Renviron:
## ~/.Renviron (e.g. C:/User/foo/.Renviron):
# Backslashes are preserved iff put within quotes
PATH="C:\Rtools\bin;C:\Rtools\gcc-4.6.3\bin;${PATH}"

x:\> R --no-environ CMD INSTALL matrixStats_0.6.2.tar.gz
=> fails

x:\> R CMD INSTALL matrixStats_0.6.2.tar.gz
=> works

As long as R is on the PATH, the above either of the approaches
removes the need to add Rtools to the PATH via a BAT file and it won't
clutter up your PATH.  This begs the question (as somewhat already
proposed), instead of users/developers doing this manually, would it
be possible to have 'R CMD ...' to locate add Rtools to the PATH
internally.  That would certainly lower the barriers for newcomers to
install packages from source that need compilation.  Obviously, this
doesn't make the tools (e.g. make) in Rtools available outside of R,
it does not allow you to build R itself from source, but it does cover
the very common use cases of calling 'R CMD build/INSTALL/check/...'.

/Henrik

PS. Hadley, is this what you meant when you wrote "Better solutions
(e.g. Rstudio and devtools) temporarily set the path on when you're
calling R CMD *.", or those approaches are only when you call 'R CMD'
from the R prompt?  I believe the latter, but I just want to make sure
I didn't miss something.
That seems like a reasonable approach although the code shown does
entail more setup and ongoing maintenance by the user than R.bat which
does not require that the user edit any files and additionally locates
R itself and has many other features.  Also, because R.bat locates R
itself it can be useful even if you are not doing development.  On the
other hand if you are looking to do development strictly from within R
then devtools is already developed.

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

        [[alternative HTML version deleted]]

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to