I can not run any of the chunks that I have created, I figured it is because they are written incorrect, since they do not have the green arrow, but cannot figure out how to get the green arrow. This is done in Rnotebook, in Rstudio.
One of the chunks looks like this:
```{r}
mu = n*a/N
"sigma^2" = (n*a*(N-a)*(N-n))/(N^2)*(N-1)
```
When trying to preview the file I get the following error message:
Fejl i yaml::yaml.load(..., eval.expr = TRUE) :
Scanner error: mapping values are not allowed in this context at line 2, column 22
White-space matters when it comes to YAML, so it seems like a white-space issue. But it is hard to tell with how your post is formatted. Can you please copy and paste your entire YAML front-matter verbatim and paste it inside code fences (three back-ticks) like this:
```
---
title: "This is my title"
---
```
If your above post is formatted as it is actually found in your Rmd file then you definitely have some whitespace issues. html_document: should be on its own line with two spaces before it, and both toc: true and toc_float: true should be below that and with four spaces. Like this:
html_document is an argument to output so it needs to be nested inside output. Similarly, toc and toc_float are arguments to html_document so they need to be nested inside that. Nesting is done by white-space/tabbing in YAML.
I made quotation marks around the chunk, since it would not show up correctly otherwise. So the quotation marks are not part of the real document.
I hope this is better to read. I am quite new to R and Rstudio, so I do very much appreciate your help
Anyway, the issue is that only options related to how the document should be rendered should be included in the YAML header. The YAML header is defined by the three slashes (---). Any prose or code needs to come afterward. Try the text/code below in your Rmd file: