This is a follow-up to a question I asked a few years back. We have a pair of computers that share a common home directory (and therefor a common .Renviron) with identical hardware, but very different sets of libraries such that using a "shared" R_LIBS between two computers does not work. They both use this as the default library for user installations: '~/R/x86_64-pc-linux-gnu-library/2.13' I would like to mod the .Renviron in such a way so '~/R/hostname-1/x86_64-pc-linux-gnu-library/2.13' '~/R/hostname-2/x86_64-pc-linux-gnu-library/2.13' How can I modify my R_LIBS_USER in the .Renviron to match this? The hostname would need to be "dynamically" set based on which computer I log into, but I tried something like this: R_LIBS_USER="~/lib/R/library/"$HOSTNAME"_%p_%a_%o_R%V" and R did not resolve the $HOSTNAME environment variable even though I can (from bash) echo $HOSTNAME and it return the correct name. Thoughts? Thanks! --j -- Jonathan A. Greenberg, PhD Assistant Professor Department of Geography University of Illinois at Urbana-Champaign 607 South Mathews Avenue, MC 150 Urbana, IL 61801 Phone: 415-763-5476 AIM: jgrn307, MSN: jgrn307@hotmail.com, Gchat: jgrn307, Skype: jgrn3007 http://www.geog.illinois.edu/people/JonathanGreenberg.html [[alternative HTML version deleted]]
On 21.11.2011 01:32, Jonathan Greenberg wrote:> This is a follow-up to a question I asked a few years back. We have a pair > of computers that share a common home directory (and therefor a common > .Renviron) with identical hardware, but very different sets of libraries > such that using a "shared" R_LIBS between two computers does not work. > They both use this as the default library for user installations: > > '~/R/x86_64-pc-linux-gnu-library/2.13' > > I would like to mod the .Renviron in such a way so > > '~/R/hostname-1/x86_64-pc-linux-gnu-library/2.13' > '~/R/hostname-2/x86_64-pc-linux-gnu-library/2.13' > > How can I modify my R_LIBS_USER in the .Renviron to match this? The > hostname would need to be "dynamically" set based on which computer I log > into, but I tried something like this: > > R_LIBS_USER="~/lib/R/library/"$HOSTNAME"_%p_%a_%o_R%V"Depends on the shells you are using and where it is defined, but you definitely need braces rather than quotes as in: R_LIBS_USER="~/lib/R/library/${HOSTNAME}" and I have to export HOSTNAME ${HOSTNAME} at first on the machines I am using to have it accessible for R. Best, Uwe Ligges> and R did not resolve the $HOSTNAME environment variable even though I can > (from bash) echo $HOSTNAME and it return the correct name. > > Thoughts? Thanks! > > --j > >
Apparently Analagous Threads
- .Renviron for multiple hardwares...
- Debian Testing: ~/.Renviron seems to not being read (R_LIBS not set)
- R CMD check --as-cran attempts to hide R_LIBS_USER but fails
- Customization options with .Renviron, R_LIBS, .Rprofile etc
- R CMD check --as-cran attempts to hide R_LIBS_USER but fails