I am working with the R programming language.
My Question: I am trying to learn how to use the rmarkdown::render()
function in R.
For example, suppose I have the following R Markdown Code:
---
title: "Storyboard Commentary"
output:
flexdashboard::flex_dashboard:
storyboard: true
---
### A nice scatterplot here
```{r}
plot(cars, pch = 20)
grid()
```
---
Some commentary about Frame 1.
### A beautiful histogram on this board
```{r}
hist(faithful$eruptions, col = 'gray', border = 'white', main = '')
```
---
Some commentary about Frame 2.
I copied and pasted the above code into a Notepad document - and then saved this file as "test_render.Rmd".
Now, I want to use the render()
function to execute this file, e.g. rmarkdown::render("test_render.Rmd")
- but I am not sure how I can import this file into R using code (i.e. without manually clicking/pointing on the file).
The reason I am asking about this, is because I am using a computer at school where we only have the older GUI version of R (i.e. we do not have R Studio) and I would like to directly import an .Rmd file into R and use this render()
function, and create the final result.
Can someone please show me how to do this?
Thanks!
CodePudding user response:
You should be able to render the rmarkdown file and export it using the input and output arguments of render, i.e.
rmarkdown::render(input = "test_render.Rmd", output_file = "test_render.html")
It should save in your current working directory.