Difference between revisions of "R"
From WPKG | Open Source Software Deployment and Distribution
(R version independent install) |
|||
Line 22: | Line 22: | ||
<source lang="xml"> | <source lang="xml"> | ||
<check type="execute" path='"%COMSPEC%" /c for /d %r in ( "%PROGRAMFILES%\R\*.*" ) do if exist "%r\bin\rscript.exe" "%r\bin\rscript.exe" -e "installed.packages()" | find /c "r_pkg_name" > NUL' condition="exitcodeequalto" value="0" /> | <check type="execute" path='"%COMSPEC%" /c for /d %r in ( "%PROGRAMFILES%\R\*.*" ) do if exist "%r\bin\rscript.exe" "%r\bin\rscript.exe" -e "installed.packages()" | find /c "r_pkg_name" > NUL' condition="exitcodeequalto" value="0" /> | ||
− | <install cmd='"%COMSPEC%" /c for /d %r in ( "%PROGRAMFILES%\R\*.*" ) do if exist "%r\bin\rscript.exe" start /wait "r_pkg_name" "%r\bin\rscript.exe" "%SOFTWARE%\r\r_pkg_name. | + | <install cmd='"%COMSPEC%" /c for /d %r in ( "%PROGRAMFILES%\R\*.*" ) do if exist "%r\bin\rscript.exe" start /wait "r_pkg_name" "%r\bin\rscript.exe" "%SOFTWARE%\r\r_pkg_name.R"' > |
<exit code="any" /> | <exit code="any" /> | ||
</install> | </install> | ||
<upgrade include="install" /> | <upgrade include="install" /> | ||
</source> | </source> | ||
− | where | + | where r_pkg_name.R contains install.packages() commands like this (change repos to your nearest [http://cran.r-project.org/mirrors.html CRAN mirror]): |
Sys.setenv("http_proxy"="http://proxy.example.com:3128") | Sys.setenv("http_proxy"="http://proxy.example.com:3128") | ||
install.packages("gbm", repos="http://cran.ms.unimelb.edu.au/") | install.packages("gbm", repos="http://cran.ms.unimelb.edu.au/") |
Latest revision as of 11:19, 1 April 2014
This is a silent installer and uninstalled for R, a statistical programming language. Each version of R can be installed in parallel, however for cleanliness we don't want that, and so uninstall older versions. The components are listed in JRins.pl however they've been reorganised in trunk which will become 2.10, more details are in theCHANGES file, under INSTALLATION.
This install works independed of the R version and installes always the newest R version. The "revision" has to be increased from time to time to trigger the upgrade of the package.
<package id="r" name="R" revision="1" priority="0" reboot="false">
<check type="uninstall" condition="exists" path="R for Windows.*" />
<install include="remove" />
<install cmd='"%TEMP%\R-release.exe" /SILENT' >
<download url='http://cran.r-project.org/bin/windows/base/R-release.exe' target="R-release.exe" />
<exit code="any"/>
</install>
<upgrade include="remove" />
<upgrade include="install" />
<remove cmd='"%COMSPEC%" /c for /d %r in ( "%PROGRAMFILES%\R\*.*" ) do if exist "%r\unins000.exe" "%COMSPEC%" /c "%r\unins000.exe" /silent'>
<exit code="any" />
</remove>
</package>
To automatically install some packages, add the following:
<check type="execute" path='"%COMSPEC%" /c for /d %r in ( "%PROGRAMFILES%\R\*.*" ) do if exist "%r\bin\rscript.exe" "%r\bin\rscript.exe" -e "installed.packages()" | find /c "r_pkg_name" > NUL' condition="exitcodeequalto" value="0" />
<install cmd='"%COMSPEC%" /c for /d %r in ( "%PROGRAMFILES%\R\*.*" ) do if exist "%r\bin\rscript.exe" start /wait "r_pkg_name" "%r\bin\rscript.exe" "%SOFTWARE%\r\r_pkg_name.R"' >
<exit code="any" />
</install>
<upgrade include="install" />
where r_pkg_name.R contains install.packages() commands like this (change repos to your nearest CRAN mirror):
Sys.setenv("http_proxy"="http://proxy.example.com:3128") install.packages("gbm", repos="http://cran.ms.unimelb.edu.au/") install.packages("Design", repos="http://cran.ms.unimelb.edu.au/") install.packages("rpart", repos="http://cran.ms.unimelb.edu.au/")