Why RStudio, when compiling an .HTML from .Rmd, tries to read my .RProfile
file?
I mean, I press the "Knit HTML" button, and then it actually tries to execute everything I have in .RProfile
, loads every library mentioned there and then fails trying to source external files (I have a bunch of self-coded functions mentioned in .RProfile
, lines like source('/Users/me/.rstudio-desktop/lib/lib.stocks.R')
, etc.
For now, I literally have to move .RProfile
out from the home directory during the compilation (knitting), but there probably should be some kind of option, or something?
Would be grateful for any suggestion :).
OS X 10.8.5, RStudio Version 0.98.1091
That is what .Rprofile
does by definition. When R starts, it reads and executes this file. RStudio launches a new R session to compile R Markdown documents, and the R session reads .Rprofile
, unless you tell the R session not to do it (e.g. via R --no-init-file
or R --vanilla
), but currently you cannot really control how RStudio launches the R session. I think if (interactive())
mentioned by @rawr is a very good idea, and is what I use routinely as well (I want my non-interactive R sessions to be "clean").
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With