I want to call the arcsinT function in R shiny. The arcsinT function returns a calculation result, a picture, and the output information of the console. I want to display this all information in the UI I designed.
I implemented this function using the following code.
But in order to achieve this, I used the arcsinT function three times in the server function, one to store the calculation result, another to output the image, and one to output the console information.
Is there a way to achieve my function by just calling the arcsinT function once? Calling three times will result in too low operating efficiency.
library(shiny)
library(astrochron)
data("modelA")
ui <- fluidPage(
sidebarLayout(
sidebarPanel(
selectInput('data','data',c("modelA")),
actionButton(inputId = "run",label = "RUN")
),
mainPanel(
plotOutput("plot"),
verbatimTextOutput("verb"),
)
)
)
server <- function(input, output, session) {
rv <- reactiveValues(modelA = modelA)
observeEvent(input$run,
{
rv[['results']] <- arcsinT(isolate(rv[[input$data]]),genplot = T)
output$plot <- renderPlot(arcsinT(isolate(rv[[input$data]]),genplot = T))
output$verb <- renderPrint(m <- arcsinT(isolate(rv[[input$data]]),genplot = T))
}
)
}
shinyApp(ui, server)