Error message while trying to create PDF in R Markdown - r

I'm trying to create a PDF in R Markdown and I keep getting this error message every time I try to click "Knit to PDF":
output file: test_4_for_r.knit.md
Output created: test_4_for_r.pdf
Error in tools::file_path_as_absolute(output_file) :
file 'test_4_for_r.pdf' does not exist
Calls: <Anonymous> -> <Anonymous>
In addition: Warning message:
In readLines(logfile) : incomplete final line found on 'test_4_for_r.log'
Execution halted
I do not have a lot of familiarity with RStudio, so I have no idea why I'm getting this message. I've read several things online saying creating PDFs in R Markdown requires several packages, but so far I've only found the name of knitr. That is the only one I have currently installed. I'm not sure if that is the issue or not.
Can someone please point me in the right direction on how to remedy this? Any help would be GREATLY appreciated.

In R-Studio Tools > Global Options, under the Sweave tab, try changing "Weave Rnw using:" from sweave to knitr. Also try
install.packages('tinytex')
tinytex::install_tinytex()
and then try to knit your PDF.
If those don't work, please paste the markdown code giving you trouble. Could you knit the example markdown file, found when you File > New File > R Markdown?

Related

R markdown not knitting because of parse raw had been removed

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!

Can't knit RMarkdown?

When I'm knitting my r markdown document it all runs smoothly until 1 chunk near the end where I get the error in the render tab (near where the console is):
error pic
I'll write down what the code says just in case the image doesn't load:
Quitting from lines 1321-1372 (narrative_analysis2.Rmd)
Error in app$vspace(new_style$`margin-top` %||% 0) :
attempt to apply non-function
Calls: <Anonymous> ... <Anonymous> -> .transformer -> clii__container_start
Execution halted
Lines 1321 - 1372 are in a specific chunk where no errors come up when I run that specific chunk. I uploaded my excel data through readxl package. The chunk before and the chunk after all run smoothly. I don't know what is the issue. narrative_analysis2 is the name I saved the markdown as.
I have reinstalled knitr, readr, readxl, cli and restarted the session and nothing has worked. I don't understand why it won't knit.
Does anyone have any advice?

Cant Knit to pdf or html

I'm trying to knit to pdf
I've installed the tinytex and kakble extra packages but it does not knit to any desired format
see the error in the screenshot below
is there something I'm doing wrong or a script or something
Kindly assist me to fix this ... although I'm new to rmd.
check error_per_server_lst, it says that the object does not exists.

! LaTeX Error: File `knitr.sty' not found

I am trying to knit a simple markdown file to a pdf using knitr and R Studio. The chunks all run fine and I have no problems knitting to an HTML document, but get the following error when trying to knit to a pdf:
! LaTeX Error: File `knitr.sty' not found.
I have reinstalled tinytex and made sure that the knitr and rmarkdown packages are up to date. I've looked around and while there are similar issue with other *.sty files, I can't find anything relating to this one.
Thanks in advance for any advice
Solved this: for some reason I had listed several R packages in the 'extra_dependencies' part of the YAML metadata. Once removed it worked.

R Markdown cannot get RStudio Version - error message in knit

I have the following line in my R Markdown code chunk
RStudio.Version()$version
when I run the knit on the R Markdown to create a Word document, I get the following error message:
Error in RStudio.Version(): could not find function "RStudio.Version"
When I run this function RStudio.Version() in RStudio console, I get the version and the function runs, but not with knit when I run R Markdown.
Anyone has an advice or solution?
I was able to replicate your issue running RStudio.Version() while knitting. As Phil suggests, rstudioapi::versionInfo() seems the best alternative while knitting.

Resources