Configuring Renviron file

Hi there. My question is about the Renviron configuration file. Is There a way to define a variable that would refer to a group and a username ? I would like to get something like this :

R_LIBS_USER=${R_LIBS_USER-'/data/users/${usergroup}/${username}/'}

Thank you.

The .Renviron file does not support the same type of dynamic evaluation that you'd get when executing something like bash, specifically:

Lines in a site or user environment file should be either comment lines starting with #, or lines of the form name=value. The latter sets the environmental variable name to value, overriding an existing value. If value contains an expression of the form ${foo-bar}, the value is that of the environmental variable foo if that exists and is set to a non-empty value, otherwise bar. (If it is of the form ${foo}, the default is "".) This construction can be nested, so bar can be of the same form (as in ${foo-${bar-blah}}).

If you are using RStudio Server, there are alternative ways to set this value, such as in the config file: Redirect.

You could also consider modifying the .libPaths inside of the Rprofile, where you have full flexibility to execute code.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.