Shiny

Shiny allow users to choose which plot outputs to display

牧云@^-^@ 提交于 2021-01-28 05:29:26
问题 I have a shiny app and my server function looks like this: shinyServer(function(input, output, session) { filedata <- reactive({ infile <- input$file1 if (is.null(infile)) { return(NULL) } myDF <- fread(infile$datapath) return(myDF) # Return the requested graph graphInput <- reactive({ switch(input$graph, "Plot1" = plot1, "Plot2" = plot2) }) output$selected_graph <- renderPlot({ paste(input$graph) }) output$plot1 <- renderPlot({ #fill in code to create a plot1 }) output$plot2 <- renderPlot({

Automatic re-reading of the source file with shinyapps.io

末鹿安然 提交于 2021-01-28 04:50:47
问题 I have an application, where I need to update the source data periodically. Source datafile is a csv file normally stored in the project directory and read with read.csv. The csv. file is changed every day with the updates. The name of the file does not change...just few cases are added. I need the application to re-read the source pdf file with some periodicity (e.g. once per day). I can do it with reactiveFileReader function and it works when I am running the application from Rstudio, but

How to download graphs which are dynamic in R Shiny?

拜拜、爱过 提交于 2021-01-28 04:25:08
问题 In Shiny Dashboard in a Tab I am plotting graphs one below the another, based on the selection of checkbox inputs. When the check boxes are selected accordingly the graphs will get displayed one below the another. Kindly find the code below which i used. library(shiny) library(shinydashboard) library(shinyWidgets) library(dplyr) d <- data.frame( year = c(1995, 1995, 1995, 1996, 1996, 1996, 1997, 1997, 1997), Product_Name = c( "Table", "Chair", "Bed", "Table", "Chair", "Bed", "Table", "Chair",

How to format the condition in a dynamically generated conditionalPanel in Shiny?

送分小仙女□ 提交于 2021-01-28 01:12:19
问题 I am trying to create widgets in Shiny by using for loop. each block contains: label check box choices selector Two numeric inputs I want to do condition for showing or hiding the two numeric inputs according to the value of the check box and the value of the choices selector. In the for loop that I created I added an index for each widget variable. I am wondering how can I execute the condition of the conditional panel in the for loop knowing that the variables are indexed in their names.

Maximum item in shinyjqui::orderInput

元气小坏坏 提交于 2021-01-28 00:57:10
问题 How to limit the number of element in an orderInput widget (from package shinyjqui ) ? For example, in the piece of code below I would like to select maximum 2 months in the first widget. ui.R library(shiny) library(shinyjqui) shinyUI(fluidPage( uiOutput("ui_source"), br(), uiOutput("ui_target1"), br(), uiOutput("ui_target2"), br() )) server.R shinyServer(function(input, output) { output$ui_source <- renderUI({ orderInput("source", label = "Months", items = month.abb, as_source = FALSE,

Shiny error while using nearPoints in renderPlotly click event

早过忘川 提交于 2021-01-27 21:11:24
问题 I would like to fetch nearPoints using the data from a click event. I have found the below snippet from the Shiny webpage and it works fine as expected. output$plot <- renderPlot({ d <- data() plot(d$speed, d$dist) }) output$plot_clickedpoints <- renderPrint({ # For base graphics, we need to specify columns, though for ggplot2, # it's usually not necessary. res <- nearPoints(data(), input$plot_click, "speed", "dist") if (nrow(res) == 0) return() res }) I tried to mimic the above the approach

Shiny: how to select opened the first subitem in menu

爱⌒轻易说出口 提交于 2021-01-27 20:31:46
问题 I have quite complicated shiny app whose all menuItems are rendered inside the server part. It's been necessary to do. And now I can't find the solution how to select opened the first subitem in menu. The first page is just blank. library(shiny) library(shinydashboard) ui <- dashboardPage( dashboardHeader( title = "Shiny" ), dashboardSidebar( sidebarMenu( menuItemOutput("Section_1") ) ), dashboardBody( tabItems( tabItem("report_1",h1("a")), tabItem("report_2",h1("b")), tabItem("report_3",h1(

How to get the cursor position in a Shiny textareaInput

╄→尐↘猪︶ㄣ 提交于 2021-01-27 20:31:38
问题 does anyone know how I can, inside a shiny application, get the cursor position inside a textAreaInput ? library(shiny) ui <- fluidPage( textAreaInput("hop" ,label="textarea",value = "Supercalifragilisticexpialidocious"), verbatimTextOutput("out") ) server <- function(input, output, session) { output$out <- renderText({ "here I would like to get the cursor position (an interger?) \n inside que textArea" }) } shinyApp(ui, server) I think I have to use javascript, but I don't know where to

Click and hold button in R shiny?

南笙酒味 提交于 2021-01-27 19:17:44
问题 I would like to be able to change the value of a parameter by clicking on a R shiny button. So I need to buttons, one for increasing and one for decreasing the value. I would like to keep the de-/increase of the value with a certain speed while holding the button. By releasing the click of the button the action should stop. So far I have not found this option for the actionButtons in R shiny. Is there another type of button which gives this opportunity? 来源: https://stackoverflow.com/questions

Basic example of fillPage in Shiny - How does it work?

妖精的绣舞 提交于 2021-01-27 17:26:02
问题 i don´t get how i can get a plot to fill my dashboard completely (besides the header). I think i have to use fillPage, but i can´t get it to work. Here is my example. I´m thankful for any hints! ipak <- function(pkg){ new.pkg <- pkg[!(pkg %in% installed.packages()[, "Package"])] if (length(new.pkg)) install.packages(new.pkg, dependencies = TRUE) sapply(pkg, require, character.only = TRUE) } packages <- c("tidyverse","shiny","shinydashboard","dashboardthemes","ggplot2") ipak(packages) #-------