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

前端 未结 2 920
南笙
南笙 2020-12-24 02:53

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

相关标签:
2条回答
  • 2020-12-24 03:41

    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

    (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.

    0 讨论(0)
  • 2020-12-24 03:52

    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.

    0 讨论(0)
提交回复
热议问题