1

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?

T.Omalley
  • 325
  • 1
  • 2
  • 9
  • Are you using `install.packages` in the "notebook"? See [this](https://stackoverflow.com/questions/33969024/install-packages-fails-in-knitr-document-trying-to-use-cran-without-setting-a) and [this](https://stackoverflow.com/questions/30674311/how-can-i-install-packages-in-knitr). I suggest installing outside the notebook and using `eval=FALSE` in the install code chunk. – NelsonGon Apr 30 '20 at 12:06
  • Hi NelsonGon.. I have read the links you gave me but I don't really understand them. I am very new to the language. I have the packages in my rmd with eval=FALSE present but when I do this I get a notification saying it cannot find my function. I have installed them in my console but still the same error – T.Omalley Apr 30 '20 at 12:20

1 Answers1

1

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.

mhovd
  • 3,724
  • 2
  • 21
  • 47
  • My current code looks like this ```{r Library, eval=FALSE} install.packages("tidyverse") library(tidyverse) library(ggmap) register_google(key = "xxx") ``` – T.Omalley Apr 30 '20 at 12:28