I have a global ~/.Rprofile
file and another .Rprofile
file located in my project's current working directory and both of the have the following contents:
.First() <- function() {
options(rstudio.markdownToHTML =
function(inputFile, outputFile) {
system(paste("pandoc", shQuote(inputFile), "-s --webtex -o", shQuote(outputFile)))
}
)
}
Unfortunately, when I open the RStudio app neither of them appear to be working. The aim of what I'm trying to do is to make the "Knit HTML" button render the Markdown file, which has inline LaTeX, process through Pandoc using webtex as the LaTeX renderer.
Does anyone know how I check whether my .Rprofile
files are loading at startup?
Thanks for any help!
POST ANSWER EDIT (after Josh's answer):
For clarity, my working project's .Rprofile
file (which works) now reads as such:
options(rstudio.markdownHTML =
function(inputFile, outputFile) {
system(paste("pandoc", shQuote(inputFie), "-s --webtex -o", shQuote(outputFile)))
}
)
\\ you will need to end with a blank carriage return underneath
The R docs should help to see how to deal with .Rprofiles. Execute the following at the console:
The relevant portion of this indicates that you need to put your project .Rprofile in the initial working directory that will be loaded when starting the project. Thus if your project is
~/foo/foobar.Rproj
, then you should have your profile be~/foo/.Rprofile
and make sure that when starting up, the initial working directory is~/foo/
. You can see this in the title bar at the top of the console pane in RStudio.Also to confirm that the correct .Rprofile is actually being loaded, I would personally put in a test to see which (if any) profile is being picked up. For example, include:
Here is another example about getting this to work:
http://support.rstudio.org/help/discussions/suggestions/1095-different-rprofile-for-a-project#comment_15690293
Finally, if the correct .Rprofile is being loaded inside the project, then there must be something wrong with your code. Looks like you got this from our docs though, so if you get the profile loaded, and continue to have problems, please let us know. You can post a new discussion on our support thread.
Josh
Product Manager - RStudio