R/ RStudio - system path issue

Solution 1:

It sounds like @kevin-ushey was on the right track: Since knitr is basically running a new R instance each time you knit the document, it is loading your .RProfile each time (assuming you have one in your user dir), and I suspect your .RProfile has that offending .libPaths(/ call in it. Try editing your .RProfile file... it looks like all you need to do it wrap whatever offending path is in there in quotes :)

Running the following from an R terminal should tell you where your user .RProfile is: file.path(Sys.getenv("HOME"), ".Rprofile").