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
ui
title = 'PRTypeCount',
tabPanel('PRTypeCount', DT::dataTableOutput('PRTypeCount')))
server
output$PRTypeCount
DT::datatable(PRTypeCount, options = list(pageLength = 25))
)
}
shinyApp(ui = ui, server = server)
解决方案
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.