Knitting error and dont know how to fix it - r

I am trying to knit and I keep getting this error:
Error in contrib.url(repos, "source") :
trying to use CRAN without setting a mirror
Calls: <Anonymous> ... eval_with_user_handlers -> eval -> eval -> install.packages -> contrib.url
In addition: Warning message:
In eng_r(options) :
Failed to tidy R code in chunk 'unnamed-chunk-2'. Reason:
Error : The formatR package is required by the chunk option tidy = TRUE but not installed; tidy = TRUE will be ignored.
Execution halted

Related

R error: “Error in contrib.url(repos, "source") : trying to use CRAN without setting a mirror…”

Error in contrib.url(repos, "source") :
trying to use CRAN without setting a mirror
Calls: <Anonymous> ... eval_with_user_handlers -> eval -> eval -> install.packages -> contrib.url
Execution halted
i tried to install ggplot but didnt work

How do i fix this knitting error (loadnamespace) and "Error in contrib.url(repos, "source"))?

I have been trying to knit I first got an error but then fixed it on the same line. However, I know keep on getting alternative errors, one
Error: package or namespace load failed for ‘vctrs’ in loadNamespace and in 'hevaan'.
And if I am not getting that error I am getting this
Error in contrib.url(repos, "source") :
trying to use CRAN without setting a mirror
Calls: <Anonymous> ... eval_with_user_handlers -> eval -> eval -> install.packages -> contrib.url
Execution halted
However, I fixed these issues with install.packages and it went to 80% of my knit but now it will not go passed 5%.

Unable to install packages from RMarkdown

I'm working on a project in RStudio, and all the code runs well. but when I try to get a report in R Makdown, I constantly recieve this error on a chunk which contains installing needed packages:
```{r installing packages, include=FALSE}
install.packages("tidyverse")
library(tidyverse)
install.packages("lubridate")
library(lubridate)
install.packages("ggplot2")
library(ggplot2)
install.packages("dplyr")
library(dplyr)
```
this is the error message: (line 21-32 means all the mentioned chunk.)
Quitting from lines 21-32 (report.Rmd)
Error in contrib.url(repos, "source") :
trying to use CRAN without setting a mirror
Calls: <Anonymous> ... eval_with_user_handlers -> eval -> eval -> install.packages -> contrib.url
Execution halted
any recommendation??
I got the error on first chunk, but each chunk runs perfectly with no error when I run them separately.

Unable to knit R markdown

The following error is shown when I try to knit my r markdown baring in mind all code runs successfully otherwise.
Error in as.ts(x) : object 'Trainingdatar2000_m' not found
Calls: <Anonymous> ... withVisible -> eval -> eval -> acf -> na.action -> as.ts
In addition: Warning messages:
1: In has_crop_tools() :
Tool(s) not installed or not in PATH: pdfcrop, ghostcript
-> As a result, figure cropping will be disabled.
2: In has_crop_tools() :
Tool(s) not installed or not in PATH: pdfcrop, ghostcript
-> As a result, figure cropping will be disabled.
Execution halted```
R Markdown evaluates in its own clean session. Your notebook needs to generate all datasets needed, and will not share objects in the parent session.

Error while documenting R package using Roxygen2

I am trying to create a documentation for my R package using roxygen2, however, when I click to document, I get the following error:
First time using roxygen2. Upgrading automatically...
Error in .f(.x[[i]], ...) : attempt to apply a non-function
Calls: suppressPackageStartupMessages ... read_pkg_description ->
read.description -> <Anonymous> -> .Call -> .f

Resources