Thanks, effectively I was using RStudio (on an Ubuntu 12.04 machine). Is there any other way to make the variable available to Rstudio? Now I have simply written the path manually, but I like the idea of having a system-wide variable :)
Thanks for your help, Rainer! On Tue, Apr 1, 2014 at 11:25 AM, Rainer M Krug <rai...@krugs.de> wrote: > Luca Cerone <luca.cer...@gmail.com> 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 -- Luca Cerone Tel: +34 692 06 71 28 Skype: luca.cerone ______________________________________________ R-help@r-project.org 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.