When using R Markdown, R Studio warned me the following message : "Rendering R Markdown documents requires an updated version of the yaml package". So I installed the latest version of the package yaml (2.2.0). But since then, I cannot knit any document in Rmarkdown (even the template or documents that were working just fine before).
I tried downloading older versions of yaml but I get the same message as at the beginning ("requires an updated version").
When I knit a document, I get the following error :
Error in yaml::yaml.load(..., eval.expr = TRUE) :
unused argument (eval.expr = TRUE)
Calls: <Anonymous> ... parse_yaml_front_matter -> yaml_load -> <Anonymous>
I had the unused argument (eval.expr = TRUE) problem after updating RStudio. Somehow it messed up with the R installation and an .Rmd that worked before, stopped working with that error.
What did the trick for me was removing yaml and installing it again.
> remove.packages("yaml")
> install.packages("yaml")
>
Related
I had created an Rmarkdown file where I read in a csv file downloaded from https://dq-content.s3.amazonaws.com/505/covid19.csv. I have the file saved with the name covid19.csv in the same folder as my Rmd file and am repeatedly getting the following error:
Error in check_dots_empty(action=warn) : unused argument
(action = warn) Calls: <Anonymous> ... format.tbl->
trunc_mat -> shrink_mat -> <Anonymous> Execution halted
The file compiled without trouble before I installed the tidyverse, stringr, and stringi packages. I am using Rstudio version 1.2.5033. Could one of these packages be causing the error?
Deleting the first line where the error occurred in my file just created the same error later in the file. I created a new file with just the following R chunk and am still getting the same error. (It will knit if I remove head(covid_df) from the below code. It also will knit if I just manually create a data frame called my_df and then look at head(my_df).):
library(readr)
covid_df<-read_csv("covid19.csv")
head(covid_df)
I'm trying for the first time to add some vignettes in my package. Everything is ok on my computer. No warning, no error. Then I uploaded it to the CRAN windows builder
devtools::check_win_release()
And I got this warning relative to vignettes:
* checking re-building of vignette outputs ... [7s] WARNING
Error in re-building vignettes:
...
Warning in engine$weave(file, quiet = quiet, encoding = enc) :
The vignette engine knitr::rmarkdown is not available, because the rmarkdown package is not installed. Please install it.
Failed with error: 'there is no package called 'rmarkdown''
Quitting from lines 172-178 (las.Rmd)
Error: processing vignette 'las.Rmd' failed with diagnostics:
cannot open the connection
Execution halted
I don't think that this issue is related to the content of the package. Can I assume that it is an "ok" warning? Can I fix it?
My DESCRIPTION file contains:
Suggests: knitr
VignetteBuilder: knitr
My vignettes/ folder contains one Rmd file
My inst/doc/ folder contains the Rmd R and html auto generated files relative the the original Rmd file.
You need to add rmarkdown in your Suggests.
I'm getting an error when Knit to pdf in rstudio using R markdown. It works without issue to Knit to html.
The error I'm getting is:
Output created: PA1_template.pdf
Error in tools::file_path_as_absolute(output_file) :
file 'PA1_template.pdf' does not exist
Calls: <Anonymous> -> <Anonymous>
In addition: Warning messages:
1: running command '"pdflatex" -halt-on-error -interaction=batchmode "PA1_template.tex"' had status 1
2: In readLines(logfile) :
incomplete final line found on 'PA1_template.log'
Execution halted
Any help on how to fix the issue would be appreciated.
James
Resolved the above for me, please see below:
Hi all,
I finally got markdown knitting. Here’s a github link with the solution: https://github.com/rstudio/rmarkdown/issues/1285#issuecomment-374340175
Make sure the Miktex console settings > General > install missing packages on the fly
Install the dev version of tinytex in r studio
install.packages('rmarkdown')
devtools::install_github('yihui/tinytex')
Also, I had changed this: In R-Studio Tools > Global Options, under the Sweave tab, try changing "Weave Rnw using:"
If I get nothing else done today, this will still make it a day to remember.
I am a new user to RStudio, and have encountered an error when using a .rmd file and Knit HTML
If I have an install.packages line:
install.packages('ggplot2');
library(ggplot2);
when I click Knit HTML, an error is returned:
Error in contrib.url(repos, "source") : trying to use CRAN without
setting a mirror calls: ... withVisible -> eval -> eval ->
install.packages -> contrib.url Execution halted
I was able to work around this using:
if (!require('ggplot2'))
{
install.packages('ggplot2');
library(ggplot2);
}
If I'm writing a .rmd, do I need to use the if (!require( line every time I install a new package? Is there a way to avoid this so I can write install.packages( only?
You don't need install.package() line everytime.
Normally you should install packages in console or a separate interactive session or delete that line after installation of that library (here it's ggplot).
Just use library(ggplot2)
library(ggplot2);
Hope it helps
I was also getting same error while using the Knit document and I did below things in the R script :
Run the command in console to set your default repository :
options(repos=structure(c(CRAN="http://cran.r-project.org")))
Add the below code in your R studio :
options(repos="https://cran.rstudio.com" )
Add the url reference for packages needed, for example :
install.packages("pscl", repos = "https://cran.rstudio.com")
LyX 2.1.1 fails to compile knitr-manual.lyx and knitr-graphics.lyx as well (currently installed knitr version 1.6).
The error does not say much (i.e. LyX: Cannot convert file -- see screenshot). Could it be related to file-permission bits? How should I go about it?
Maybe of interest,
Sys.getlocale()
[1] "LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=C;LC_MONETARY=en_US.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C"
Update
From the message pane, there is indeed an Error line:
12:28:16.235: Quitting from lines 93-93 (/tmp/lyx_tmpdir.gwIlgToM2017/lyx_tmpbuf1/knitr-graphics.Rnw)
12:28:16.238: Error in loadNamespace(name) : there is no package called 'Cairo'
12:28:16.241: Calls: knit ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous>
12:28:16.244:
12:28:16.247: Execution halted
No cairo? What does this mean in the contect of knitr and LyX/LaTeX?
R was missing the "Cairo" package. And the "tikzDevice" package as well. Installing those two, via
install.packages("Cairo", dep = TRUE)
install.packages("tikzDevice", dep = TRUE)
resolved the issues. At least, there is no compilation error related to missing packages anymore.