Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to host interactive R Markdown files on Github Pages?

Tags:

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?

like image 903
xyy Avatar asked Jul 01 '16 06:07

xyy


People also ask

Can you upload R Markdown to GitHub?

Create a new repository. Work with your repository on your local machine using Git and RStudio. Use the GitHub.com website or GitHub Enterprise to complete the GitHub workflow. Publish and share your R Markdown documents using GitHub Pages.

Can R Markdown be interactive?

R Markdown documents are a perfect platform for interactive content. To make your documents interactive, add: Interactive JavaScript visualizations based on htmlwidgets, or. Reactive components made with Shiny.

Does GitHub Pages support Markdown?

GitHub Pages supports two Markdown processors: kramdown and GitHub's own Markdown processor, which is used to render GitHub Flavored Markdown (GFM) throughout GitHub. For more information, see "About writing and formatting on GitHub."

What can you host on GitHub Pages?

You can use GitHub Pages to host a website about yourself, your organization, or your project directly from a repository on GitHub.com.


1 Answers

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.

like image 72
Keith Hughitt Avatar answered Oct 17 '22 16:10

Keith Hughitt