R markdown adds # link behind HTML headers - r

I've been trying to solve some HTML knitting issues. My HTML does not currently allow me to use HTML in the code, and thus I am unable to create tabsets.
However, while trying to solve that issue a new issue occured: My HTML output adds a clickable # behind each # Header.
I use the basic Rmarkdown format:
---
title: "Try"
output: html_document
---
/```{r setup, include=FALSE}
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:
## Including Plots
And then the output shows me this:
Anyway have any idea how to solve this?

This is a new feature introduced in the current development version of rmarkdown. See the NEWS file for more info. To disable this feature, you may use:
output:
html_document:
anchor_sections: false

Related

rmarkdown, columns for text in word documents

using Rmarkdown with R studio.
I am making a word document (html will not do).
I have a text in a rmarkdown, sometime contains code block.
I am trying to create two columns from this text. :
---
output: word_document
---
#Column 1
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>.
#Column2
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:
I have been unable to find any solutions or anything close to a solution. The closes I have come is using \begin{column} and \end{column}, but it was an old tutorial and did not work for me... or I was doing it wrong.
Try the following in your YAML header -
classoption: twocolumn

Render latex text from within r function in rmarkdown?

I am working within RStudio 1.1.383 using rmarkdown. I am trying to render to Latex a string that is created within a knitr chunk so that it appears as latex code within the document.
So far I have experimented with the 'results=' options in the chunk header and find that results='asis' enables it to be rendered once the document is knitted, but I have not been able to find a way to enable the result to be rendered using the preview feature that allows you to run a single chunk and see the results within the .Rmd editor.
Any help on this matter would be appreciated.
A minimal example is included below that should be copied into a .Rmd file before rendering.
Thanks in advance,
Michael
---
title: "Minimal Example"
output: html_document
---
```{r}
str <- "$$\\alpha \\cdot \\beta = \\delta$$"
# this doesn't show in the preview 'run chunk feature'
cat(str, "\n")
# neither does this
writeLines(str)
```

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.

Rmarkdown and rstudio - reveal js print pdf.css error

After I have created a revealjs-presentation in my Rstudio-project, i proceed to open it. This works fine except that I get an error in my browser (Chrome) that pdf.css doesn't exist. Which it doesn't, because the presentation is looking for it in a sub-folder in my project directory. Now, I can add pdf.css according to the path that fails and the presentation works...until I re-run it and the added directory is deleted (I guess the knit process delete the aformentioned sub-folder?)
This is a minor problem but there seems to be something buggy going on here, anyone got any idea what I could do (besides re-installing everything)?
Example at the bottom
---
title: "Untitled"
output: revealjs::revealjs_presentation
---
## R Markdown
This is an R Markdown presentation. 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.
## Slide with Bullets
- Bullet 1
- Bullet 2
- Bullet 3
## Slide with R Code and Output
```{r}
summary(cars)
```
## Slide with Plot
```{r, echo=FALSE}
plot(cars)
```
And this is the folder-tree that's missing (relpath from a given Rstudio project):
Failed to load resource: net::ERR_FILE_NOT_FOUND
/TestRevealJs_files/reveal.js-3.3.0/css/print/paper.css
Where TestRevealJs is the name of the project.

Why does the test-RMarkdown in R-Studio give an html that does not show any results after pressing the knit-button?

I opened a new R Markdown file in R studio and got the default small working example.
---
title: "test"
author: "Katharina Zweig"
date: "30. Januar 2016"
output: html_document
---
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}
summary(cars)
```
You can also embed plots, for example:
```{r, echo=FALSE}
plot(cars)
```
Note that the `echo = FALSE` parameter was added to the code chunk to
prevent printing of the R code that generated the plot.
It says, you only need to press the knit button to create an HTML
containg the text, the code and the results of the code. I got some long
error logs that were hardly helpful. Neither did changing the output to
PDF and Word - same result: text was there, code was there, no results of
running the code. By producing the output, the original file vanished.
What is wrong?
When the knit button is used on a file not yet saved, it asks you under which name to save it. The file needs to be saved as an Rmd file - just give no extension and R-Studio will do it right. Then, the file does not vanish and the resulting document contains the results of the r commands. I thought it asked where to save the output and gave it the extension of the output file, i.e., either myfile.html / myfile.pdf / myfile.doc.
In the chunk option try this:
{r, results='asis'}
summary(cars)
You can also embed plots, for example:
{r, echo=FALSE, results='asis'}
plot(cars)
The results = 'asis' command should output the tables and graphs if not please let me know.

Resources