I ran Compile PDF using RStudio with knitr on my document. I then received the error
Line 2333 Error in FUN(left, right) : non-numeric argument to binary operator
I understand where this error can normally occur. However, in this instance I cannot.
Running the purled version of the knitr script produces no errors. That is, there are no problems with the R chunks.
There is no R code on line 2333 of the .Rnw file. Only pure LaTeX. Replacing the LaTeX code with a % produces the same error (and on the same line).
When I comment out the previous lines, I get the same error, always on the line just before the commented-out line.
What should I do to diagnose this problem?
The error was in an inline (\Sexpr) function in a subsequent line of the knitr file.
Related
I've been having problems on knitting Rmarkdown, and it's been frustrating that I have no idea what to do. Every time I knit them, it always ended up with an error like this
output file: -R--Pengenalan_R.knit.md
--parse-raw/-R has been removed. Use +raw_html or +raw_tex extension.
Unknown option ---Pengenalan_R.knit.md.
Try pandoc.exe --help for more information.
Error: pandoc document conversion failed with error 6
Execution halted
I've also tried to reinstall my Rstudio but it doesn't work either. Does anyone have a clue how to solve this? Thank you in advance!
I am writing my thesis in R markdown and I get the following error when I try to knit:
! Undefined control sequence.
l.404 ... We reject the null hypothesis of (r \eq 0) at a 1% level of
Error: LaTeX failed to compile Thesis_Draft.tex.
The R markdown file includes tables, graphs, code chunks and math equations. What could be causing the problem with knitting?
The issue I was having came from incorrectly typing $r \eq 0$ instead of $r \geq 0$. Once I fixed this, I had no more issues knitting. If you get a similar error (! Undefined control sequence), check that any inline mathematical notation in the text chunks is valid.
When I run my Rmarkdown program interactively chunk-by-chunk, the program runs successfully without errors, however, when I try to knit it, I get this error message:
Error in dirname(name) : path too long
Any ideas what could be causing this?
If you get this error message, check the length of your code chunks in your Rmarkdown code. I was getting the above error because one of my chunks were named as follows:
```{r additional descriptives and other statistical tests tests,echo=FALSE,message=FALSE,warning=FALSE}
Through trial and error, I found out the maximum length for the code chunk description is 48 characters. As long as the description has 48 or fewer characters, this error will not get triggered.
I'm working on some education manuals in spanish for a course, so I'm making a Sweave document with some chunks and I'm trying to make an example of an error message. But first I need to show the souce of that error, so I'm using this code, since I don't want the code evaluating I'm using eval=FALSE:
<<eval=FALSE, error=TRUE,tidy=FALSE>>=
c(1,2 3)
#falta una coma
#
But the code is still evaluating and it's not letting me print the document, giving me this error message
(chunk 306) 5305:7: unexpected numeric constant
Your code is being parsed, not evaluated. If you have current versions of the knitr and evaluate, this should result in a warning in the knitr log, it won't stop the run. I'm using knitr 1.16 and evaluate 0.10.1 and things are fine. See knitr: knitting chunks with parsing errors for a bit more on this.
(BTW, I think you're using knitr, not Sweave. They're different. Sweave can't handle this. If you really are using Sweave, switch to knitr. The switch is not hard, and brings a lot of benefits.)
I am getting an error message while running knit to HTML. But If I run chunk individually, it draws plot as expected.
What would be a problem? The error message is below:
Quitting from lines 270-274 (HC_FC_indivisual_cellline_fdr_1%.Rmd)
Error in png(..., res = dpi, units = "in") : invalid 'filename' Calls:
... in_dir -> plot2dev -> do.call -> -> png
Execution halted
The described error also occurs, when you are knitting plots within named code chunks, and the name of the chunk does not lead to a valid path name during knitting process.
That is, during the knitting process the plots are written into a temporary path which contains the name of the code chunk, ergo this name should contain only characters that are valid for path names. One should avoid to use white characters for chunk names as well.
I ran into the same issue. I ran this right before my first plot in the chunk and it solved it for me
dev.off()
hope this helps.
I had the same problem. I updated R to the latest version and also RStudio. Install the required packages for the knit and then everything became fine.
Adding 'dev.off()' can solve the problem for knitting but will cause another problem and does not show the plots in the HTML file.