Open a Flexdashboard in another browser tab with "Runtime:Shiny" through an Actionbutton in a Shiny app

Asked

Viewed 114 times

0

I have a Shiny application of the following structure, where the following code is named app.R

    library(shiny)


    ui <- fluidPage(

        theme = shinytheme("darkly"),
        navbarPage(title = "Teste ",
               tabPanel("Renderizar Rmarkdown em outra aba",

                            actionButton("teste", "Teste app dentro app"))
    ))

    server <- function(input, output) {
           observeEvent(input$teste, {
         rmarkdown::run ("arquivo.Rmd")
         })
}

Inside Shiny there is the execution of a flexdashboard, via rmarkdown :: run, because the flexdashboard contains the parameter runtime:shiny

where what has been termed arquivo.Rmd, has the following structure

---
title: "Gene Expression Biclustering"
author: "Bryan Lewis"
output: 
  flexdashboard::flex_dashboard:
    orientation: rows
    social: menu
    source_code: embed
runtime: shiny
---

```{r global, include=FALSE}
# load data in 'global' chunk so it can be shared by all users of the dashboard
library(biclust)
data(BicatYeast)
set.seed(1)
res <- biclust(BicatYeast, method=BCPlaid(), verbose=FALSE)
```

Inputs {.sidebar}
-----------------------------------------------------------------------

```{r}
 selectInput("clusterNum", label = h3("Cluster number"), 
    choices = list("1" = 1, "2" = 2, "3" = 3, "4" = 4, "5" = 5), 
    selected = 1)
```

Microarray data matrix for 80 experiments with Saccharomyces Cerevisiae
organism extracted from R's `biclust` package.

Sebastian Kaiser, Rodrigo Santamaria, Tatsiana Khamiakova, Martin Sill, Roberto
  Theron, Luis Quintales, Friedrich Leisch and Ewoud De Troyer. (2015). biclust:
  BiCluster Algorithms. R package version 1.2.0.
  http://CRAN.R-project.org/package=biclust

Row
-----------------------------------------------------------------------

### Heatmap

```{r}

num <- reactive(as.integer(input$clusterNum))

col = colorRampPalette(c("red", "white", "darkblue"), space="Lab")(10)
renderPlot({
    p = par(mai=c(0,0,0,0))
    heatmapBC(BicatYeast, res, number=num(), xlab="", ylab="",
      order=TRUE, useRaster=TRUE, col=col)
    par(p)
})
```


Row {.tabset}
-----------------------------------------------------------------------

### Parallel Coordinates

```{r}
renderPlot(
  parallelCoordinates(BicatYeast, res, number=num())
)
```

### Data for Selected Cluster

```{r}
# only display table for values in cluster 4
renderTable(
  BicatYeast[which(res@RowxNumber[, num()]), which(res@NumberxCol[num(), ])]
)
```

I created another code, with the following data, where I made one. bat to it, and a shortcut on my desktop, and by clicking the shortcut , the app opens directly on Chrome

library(shiny)
runApp("C:\\Users\\holiveira\\Desktop\\trabalhando\\teste", launch.browser = TRUE)

The big problem is I couldn’t make one Shiny execute a .Rmd with runtime: shiny

I would like a solution for my shinyapp actionbutton to run this flexdashboard in another browser tab

  • 1

    Try to put runtime: shiny above output in the header YAML.

  • It did not work, apparently there is a limitation of running a Shiny inside another Shiny, I thought of trying via code run through another session, but I still could not. An output is to climb several Shiny to shinyapps.io, and create a button screen that directs to the shiny link, but this would be very expensive, if it could run straight would be ideal Warning: Error in <Anonymous>: Can’t call runApp() from Within runApp(). If your application code contains runApp(), Please remove it.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.