Luca Cerone <[email protected]> writes: > Dear all, > in my .bashrc file I have set the environment variable R_HISTFILE like this: > > export R_HISTFILE="$HOME/.Rhistory" > > I then use it in my .Rprofile to have R writing all the history in a > single file, rather than on a per directory basis. > However this doesn't work becaus R_HISTFILE is not recognized by R.
Which OS? How do you start R?
There is a difference between login shell (executed when you log in) and
non-log in (I thik interactive shell? don't know the actual
name). .baschrc is only executed after you are logged in and start the
shell. So when you start R from the shell, it should work - you can
check by
echo $R_HISTFILE
which should show you the value of the variable.
If you are starting R the R gui (on Mac or RStudio) .bashrc is not
sourced. Checo online for the file which will be sourced by the login
shell - different between OS and distros.
Cheers,
Rainer
>
> If I type: Sys.getenv("R_HISTFILE")
> the output is: ""
>
> How can I get R recognizing environment variables?
>
> Best,
> Luca
--
Rainer M. Krug
email: Rainer<at>krugs<dot>de
PGP: 0x0F52F982
pgpP5L0HaSJsX.pgp
Description: PGP signature
______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

