23

As the title says, I would like to create posts on Github Pages that are interactive R Markdown files (meaning that it has Shiny apps embedded in it). Is this possible to do in Github Pages? If so, how can I do it; and if not, what's the best (free) way to host interactive RMD/Shiny pages?

xyy
  • 547
  • 1
  • 5
  • 12
  • RStudio offers [shinyapps.io](https://www.rstudio.com/products/shinyapps/) – Gregor Thomas Jul 01 '16 at 06:20
  • 1
    @Gregor I am aware, just wondering if there's a way to create blog-like posts with embedded shiny instead of having to link to separate shinyapps.io pages. – xyy Jul 01 '16 at 06:27
  • I believe that no server side tech is allowed on github pages http://stackoverflow.com/questions/15718649/how-to-publish-a-website-made-by-node-js-to-github-pages As such I can't see how you could do this other than link to some other host. – Philip Parker Jul 01 '16 at 06:41
  • 2
    You can run RMarkdown files with html widgets embedded ( highcharter,leaflet etc.) on github, but not full blown shiny apps. Shiny apps can only be run on a server with RStudio Server installed. – hvollmeier Jul 01 '16 at 07:57

2 Answers2

25

While it's not possible to host fully-fledged Shiny apps on Github pages (Indeed, as @Gregor suggested, shinyapps.io is useful for this), the devs for Shiny have been working to make some of the functionality run completely on the client-side via htmlwidgets.

Here is a simple example running on Github pages:

README.Rmd

## Example of displaying htmlwidgets on a Github pages site

```{r}
# Source: http://www.htmlwidgets.org/showcase_plotly.html
library(plotly)
p <- ggplot(data = diamonds, aes(x = cut, fill = clarity)) +
            geom_bar(position = "dodge")
ggplotly(p)
```

Rendered HTML

Screenshot of htmlwidgets demo

(Live version: Github pages htmlwidget demo)

For more complex interactions, including communicating between widgets entirely on the client-side, check out Joe Cheng's recent crosstalk demo from UserR! 2016.

Keith Hughitt
  • 4,860
  • 5
  • 49
  • 54
  • 4
    how do you translate an rmarkdown knitr interactive shiny doc into a working github pages webpage? Do I simply change my rmd file to an html file?? – theforestecologist Apr 21 '17 at 18:42
1

When you render an rmd file you can also knit it to HTML as well and you can then host that page on github pages.

gmach
  • 39
  • 2