1

I'm developing a shiny app that help users to install Bioconductor packages not installed in their machines.

Following this post regarding printing out r console in a shiny app, I'm trying to print out all the messages you regularly get when you install a new package in a R console.

An example would be like this:

library(shiny)
library(shinyjs)
library(BiocManager)

names <- c("shinythemes")

foo <- function() {
  BiocManager::install(names, update=FALSE)
}

runApp(shinyApp(
  ui = fluidPage(
    shinyjs::useShinyjs(),
    actionButton("btn","Click me"),
    textOutput("text")
  ),
  server = function(input,output, session) {
    observeEvent(input$btn, {
      withCallingHandlers({
        shinyjs::html("text", "")
        foo()
      },
      message = function(m) {
        shinyjs::html(id = "text", html = m$message, add = TRUE)
      })
    })
  }
))

What I get in the shiny app is just one line:

Bioconductor version 3.12 (BiocManager 1.30.10), R 4.0.2 (2020-06-22) Installing package(s) 'shinythemes'

while I want to get all the lines printet out in r console (eg:

My R console

Thanks for your time

Pabort
  • 348
  • 1
  • 11

0 Answers0