Writing Rmarkdown Code in "Ri 386 4.0.3"?

I had the following question - suppose I directly open "R i386 4.0.3" (instead of R Studio):

My Question: Is it possible to run "R Markdown Code" within "R i386 4.0.3" ?

Suppose I have this R Markdown Code (source: R Markdown Format for Flexible Dashboards • flexdashboard) :

---
title: "Dygraphs Linked Time Series"
output: 
  flexdashboard::flex_dashboard:
    orientation: columns
    social: menu
    source_code: embed
---

```{r setup, include=FALSE}
library(dygraphs)
library(quantmod)
library(flexdashboard)

getSymbols(c("MSFT", "HPQ", "INTC"), from = "2014-01-01", auto.assign=TRUE)
```

### Microsoft

```{r}
dygraph(MSFT[,2:4], group = "stocks") %>% 
  dySeries(c("MSFT.Low", "MSFT.Close", "MSFT.High"), label = "MSFT")
```

### HP

```{r}
dygraph(HPQ[,2:4], group = "stocks") %>% 
  dySeries(c("HPQ.Low", "HPQ.Close", "HPQ.High"), label = "HPQ")
```

### Intel

```{r}
dygraph(INTC[,2:4], group = "stocks") %>% 
  dySeries(c("INTC.Low", "INTC.Close", "INTC.High"), label = "INTC")
```

Normally I would have created a new R Markdown Document within R Studio, copy/pasted this code there and then create the file.

I was just wondering - is it possible to do this in "Ri 386 4.0.3"? Can I enter R Markdown Code within "Ri 386 4.0.3" - or is this fundamentally impossible?

Thanks!

The R GUI doesn't have facilities for literate programming but you can save the content in a text file, save it with the .Rmd extension and render the document with the rmarkdown::render() function.

1 Like

Thank you! Is there another argument I need to add to make sure that it renders specifically to a flexdashboard? Or is this automatic since I have included this detail in the code itself?

The rendering output is defined in the YAML header of the document but flexdashboards are a special case, they produce html output but if your document includes shiny components it needs to be deployed to shiny-server, shinyapps.io or Posit Connect in order to work.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.