Skip to main content
Stack Overflow for Teams is now Stack Internal: See how we’re powering the human intelligence layer of enterprise AI. Read more >
deleted 166 characters in body; edited tags
Source Link
Jan
  • 11.9k
  • 7
  • 24
  • 35

I am pretty new to R Shiny and am just starting to look into shinyapps.io functionality and if my goal is feasible. Any direction to try out is greatly appreciated.

I am pretty new to R Shiny and am just starting to look into shinyapps.io functionality and if my goal is feasible. Any direction to try out is greatly appreciated.

Source Link
MBS
  • 3
  • 2

Is it possible for a deployed app on shinyapps.io to open and run another app (Fiji) on the client side?

I have built a Shiny App that works well locally and is able to automatically open a separate app (ImageJ Fiji), run a macro code to analyze an image, and then feed the results back to the Shiny App using the following:

Path0 <- "C:/Users/Username/Fiji.app/ImageJ-win64.exe --ij2 --run C:/Users/Username/Fiji.app/macros/TestingShiny.ijm"
system(Path0)

I'm now trying to use shinyapps.io to run the app so that other users will not have to download R in order to run the full analysis (I'm thinking Fiji will still need to be downloaded on every user's computer).

I made a very abbreviated version of my app to test out, and there is (understandably) a disconnect when trying to run this file path and system call once deployed on shinyapps.io.

## Load Packages
pacman::p_load(pacman, rmarkdown, shiny, shinydashboard, shinyWidgets, fresh, here, tinytex, htmlwidgets)

# Create the theme
Theme <- create_theme(
  adminlte_color(
    red = "#FF4719"
  ),
  adminlte_sidebar(
    dark_bg = "#293745",
    dark_hover_bg = "#3CAAFF",
  )
)

## Assign File Paths
Path0 <- "C:/Users/Username/Fiji.app/ImageJ-win64.exe --ij2 --run C:/Users/Username/Fiji.app/macros/TestingShiny.ijm"

ui <- dashboardPage(skin = "red",
                      
                      dashboardHeader(
                        title = h4(HTML("Test"))),
                      
                      dashboardSidebar(
                        sidebarMenu(id = "sidebarid",       
                                    menuItem("Test Run", tabName = "info"))),
                                    
                      
                      dashboardBody(
                        use_theme(Theme),
                        tabItems(
                          tabItem(tabName = "info",  
                                  fluidRow(
                                    column( width = 4,
                                            fluidRow(
                                    actionBttn(inputId = "go", label = "Go!"),
                                    tableOutput(outputId = "text"))
                      )
  )))))
  

  server <- function(input, output, session) {
    ## Sets observeEvent with eventReactive for Go button click  
    observeEvent(input$go, {
      
      ## Runs Fiji and accompanying macro
      system(Path0) 
      
      ## Pulls Result file from Output folder
      Result <- eventReactive(input$go, {read.delim(Path1)})
      Filepath1 <- here("Output", "Log.txt")
      write.csv(Result(), Filepath1 , row.names = FALSE)
      ## Displays the result
      output$text <- renderTable(align = 'c', {Result()})
      
      })}
  
  
  shinyApp(ui, server)

Is there a way to pass the file path of the Fiji app and macro file on the client's side so that it can open and run on their computer then feed the results back to the Shiny App? Would shinyFiles or shiny::fileInput() work here?

I am pretty new to R Shiny and am just starting to look into shinyapps.io functionality and if my goal is feasible. Any direction to try out is greatly appreciated.