Writing function in R markdown

Viewed 40

Hi I have a very big function-i (to later use with a apply function) that I made in R studio. I am writing the function in R Markdown and I want to include text within the function-i to make it easier for the reader to understand what is happening within the function-i. Is there is a good way to do it? I tried this way and it does not work:

```{r}
f <- function (i) {
 part 1
```{r}
Text or comment 1
```{r}
part 2
```{r}
Text or comment 2
```{r}
part 3
```{r}
Text or comment 3
```{r}
part4
}

It gives me several errors. Thanks for the help.

0 Answers
Related