How to embed shiny app on SharePoint with Iframe tag

﹥>﹥吖頭↗ 提交于 2019-12-21 21:50:17

问题


I have a very simple app showing some data. How do you embed this in a SharePoint site using using iframe ? or is there an easier way to do this ?

library(ggplot2)
library(shiny)
library(DT)
library(readr)

PRTypeCount <- read_csv("H:/SP/PRTypeCount.txt")



ui <- navbarPage(
title = 'PRTypeCount',
tabPanel('PRTypeCount', DT::dataTableOutput('PRTypeCount')))

server<-function(input, output) {

output$PRTypeCount <- DT::renderDataTable(
DT::datatable(PRTypeCount, options = list(pageLength = 25))
)

}

shinyApp(ui = ui, server = server)

回答1:


If you do not have a shiny server your best bet is probably the flexdashboard package or making individual components and arranging them in SharePoint designer. Here is a quick example, you will be somewhat limited with interactivity as compared to shiny -- there are some things you can do with plotly, ggiraph, and some other packages. For many use cases this can be perfectly adequate:

---
title: "Untitled"
output: 
  flexdashboard::flex_dashboard:
    orientation: columns
    vertical_layout: fill
---

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

Column {data-width=650}
-----------------------------------------------------------------------

### Chart A

```{r}
DT::datatable(iris)
```

Column {data-width=350}
-----------------------------------------------------------------------

### Chart B

```{r}

hist(iris$Sepal.Length)

```

### Chart C

```{r}
plot(iris$Sepal.Length, iris$Sepal.Width)

```

Once you knit this rmd file to html. You make can make a copy of the HTML file and change the extension to .aspx.

Then you can put this .aspx file in in a document library.

Then add a page viewer web part where you want the content displayed, linking it to the .aspx file in the document library.



来源:https://stackoverflow.com/questions/44334272/how-to-embed-shiny-app-on-sharepoint-with-iframe-tag

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!