I am getting the same error and at the end it was not really explained how the error was solved can anyone help me with this?
There's discussion on this reply helping diagnose the issue.
What happens when you take cderv's advice there?
This is not an error with Rmarkdown, it is an error with R saying you don't have any CRAN repo configure. If you have a call to install.package or else in your Rmd doc, it could cause the error.
Just configure a cran mirror if you haven't one. Are you using RStudio IDE BTW?