R markdown error: can't produce HTML file - r

I can't produce an HTML document from any .Rmd file by pressing the Knit HTML button in R Studio, including the sample document that summarizes and plots the cars dataset. Here's the error message that I get:
Error: unrecognized fields specified in html_dependency: attachment
Execution halted
However, I can produce the HTML document by running the command knit2html("file.Rmd"). The Knit PDF button also functions properly. Does anyone have an idea about how to fix this error?
Here's the sample .Rmd file that I have:
title: "Untitled"
author: "blakeoft"
date: "Friday, September 12, 2014"
output: html_document
---
A summary:
```{r}
summary(cars)
```

I had the same problem which went away after upgrading to RStudio version 0.98.1056 (released 9 September 2014).

As I've answered on another thread, updating RStudio didn't work for me. So I tried updating all R packages (Tools > Check for Package Updates...) and then it worked.

Related

R markdown beamer presentation returning undefined control sequence

Whenever I tried to knit R markdown in beamer presentation format, it keeps on giving me undefined control sequence.
It is fraustrating because it worked fine until yesterday and I have no idea what I changed that causes this error.
To show that my code is not the source of the problem, I simply tried to knit an empty page.
code:
---
title: "untitled"
output: beamer_presentation
---
Output:
output file: a.knit.md
! Undefined control sequence.
<argument> ...{subsubsection}\addtobeamertemplate
{theorem begin}{\expandaft...
l.322 }{}
My original file returns the exaclty same error message.
I tried:
reinstall LaTeX
reinstall RStudio
upgrade all packages in R
Any idea how to fix this?
This was just fixed by #UlrikeFischer. #JosephWright is preparing a new beamer release as we speak, it should be available as beamer v3.67 on ctan tomorrow.
As a temporary workaround, place these two files in the folder of your .rmd file:
https://raw.githubusercontent.com/josephwright/beamer/main/base/beamer.cls
https://raw.githubusercontent.com/josephwright/beamer/main/base/beamerbasesection.sty
(don't forget to delete these files again once you have the new beamer version, otherwise they might interfere with future updates)

Very simple .rmd --> beamer_presentation; still cannot get rid of "Option clash for package xcolor"

I cannot compile to a pdf-beamer from a very simple minimal example (below), with no packages.
I click - Knit - Knit to pdf
(Note this is not a duplicate of previous posts, because those all involved using Kable; I am not using it; fresh restart not calling any packages here)
I tried with and without classoption: table
Knit to html works just fine.
Restarted Rstudio; no improvement
---
title: "Untitled"
author: "Test"
date: "20 novembre 2018"
classoption: table
output:
beamer_presentation:
keep_tex: yes
---
# Test nothing
blah
```
Throws error: ! LaTeX Error: Option clash for package xcolor.
I want it to compile a beamer pdf slide show, of course.
I've put the log file here
My default.beamer (stored at /Users/yosemite/.pandoc/templates/default.beamer I think) is linked HERE

'Error in gregexpr' when render R Markdown to HTML

My RStudio(version 1.1.414) is not able to render a R Markdown file into HTML. I have a very simple R Markdown file called testHTML.Rmd:
---
title: "Untitled"
output:
html_document: default
---
## R Markdown
This is a test!
In my main R code, I am calling the render() statement as render('testHTML.Rmd'). I got the following error message related to regexp:
Error in gregexpr("(?)`r[ #]([^`]+)\\s*`", "---\ntitle:
\"Untitled\"\noutput:\n html_document: default\n \n---\n", : invalid
regular expression '(?<!(^| ))r[ #]([^]+)\s*`', reason 'Invalid
regexp'
Has anyone seen this error before when knit an R Markdown file? What is the solution?
For me updating all installed packages worked after I got the same error message.
The problem occured after updating RStudio to 1.1.463 and R to 3.5.2. I was asked to update knitr, rmarkdown and yaml ( I think, at least three packages were mentioned ). After updating yaml the error occured.
Updating all existing packages made the error disappear again. Hope this helps.

Knitr HTML preview fails in RStudio, though render() successfully creates HTML file

I'm getting started with rmarkdown and knitr. In the sample document provided by RStudio, I can successfully use render() to generate an HTML file that views fine in Chrome. However, when I click on the knit button, it generates a .markdown file and then returns the following error without rendering the preview:
Error generating HTML preview for ~/path/to/file/report.rmarkdown system error 2 (The system cannot find the file specified)
I think it's getting hung up at the pandoc stage. Is it possible that RStudio is looking for pandoc in the wrong place? Pandoc was already installed at C:\Program Files (x86)\Pandoc\pandoc.exe, but RStudio installed its own instance at C:\Program Files\RStudio\bin\pandoc\pandoc.exe, so maybe it's looking in the wrong place and/or confusing settings from one with the other?
Any help would be greatly appreciated. Thanks!
And just in case, here's the RMarkdown template I'm starting with:
---
title: "Monthly Report"
author: "Kris Shaffer"
date: "February 17, 2017"
output: html_document
---
```{r setup, include=FALSE}
library(knitr)
knitr::opts_chunk$set(echo = TRUE)
```
## R Markdown
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.
When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
```{r cars}
summary(cars)
```
## Including Plots
You can also embed plots, for example:
```{r pressure, echo=FALSE}
plot(pressure)
```
Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of the R code that generated the plot.
R version 3.3.2
RStudio 1.0.136
rmarkdown 1.3
knitr 1.15.1
pandoc 1.17.2 (both installations)
Turns out it was as simple as a file extension. I changed the filename from report.rmarkdown to report.Rmd. Knit works fine now.

How to build a pdf vignette in R and RStudio

I am new to writing R packages. I'm trying to learn how to make a vignette for my package. I have created a vignettes folder with a file "getting-started.Rmd"
---
title: "WaterML Tutorial"
author: "Jiri Kadlec"
date: "`r Sys.Date()`"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{Introduction to the WaterML R package}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
## Quick Start
This simple example shows how to get started with the <my R package>.
To build the vignette I use the command:
devtools::build_vignettes()
Then I run Rcmd.exe INSTALL my_package, and to view my vignette I run:
browseVignettes("my_package")
However I only see the vignettes in the html and source format:
As you see in the screenshot, there's no "pdf" option. How do I configure my .Rmd file to create my vignette in the pdf format?
In your header, you are telling R to output only an html vignette in line:
output: rmarkdown::html_vignette
If you want pdf, try:
output: pdf_document
According to R packages:
Output: this tells rmarkdown which output formatter to use. There are many options that are useful for regular reports (including html, pdf, slideshows, …) but rmarkdown::html_vignette has been specifically designed to work well inside packages. See ?rmarkdown::html_vignette for more details.
So you might have a few small problems using a raw pdf.
At this time, rmarkdown does not have a output: rmarkdown::pdf_vignette option

Resources