Search code examples
rr-markdowncodemirrorcran

I keep getting a knit error with my markdown file in R


I am receiving this error when trying to knit my R markdown sheet

Error in contrib.url(repos, "source") : trying to use CRAN without setting a mirror calls: ... withVisible -> eval -> eval -> install.packages -> contrib.url Execution halted

Does anyone have any experience with this?


Solution

  • Without the exact code, it is difficult to assess the problem. However, as @NelsonGon writes, this is usually the error from running an installation (install.packages() inside a chunk.

    Instead, the library should be installed beforehand and loaded with library(example) inside a chunk to make it available for the markdown environment.