shiny-reactivity

Creating a SQL query using selectinput in R shiny

你。 提交于 2019-12-08 18:14:25
I am trying to create a dynamic query using select input. Something like Select * from basket where fruits in("apple","banana","cherry") I have a table called fruit_list which populates my selectinput box. selectInput("fruit_list", label = h5("Select fruit"), multiple = T, choices = (dbGetQuery(conn, "SELECT fruit from fruit_list');"))) So far, when i renderprint my selection I get "apple" "banana" "cherry" I need a comma between the elements to get "apple","banana","cherry" When i choose a single element from the multiselect box "apple" Select * from basket where fruits in("apple") my

How can I turn my main dataframe into a reactive object on start?

瘦欲@ 提交于 2019-12-08 13:18:43
问题 I developed a nice leaflet-based shiny app where users can visualize over 50 socio-urban-demographic variables on a map displaying over 3000 polygon features. Users can also pick and transform any variable, perform regressions, build custom indexes and even run a spatial clustering algorithm. So, as you might have guessed already, the basic data structure consists of a main CSV dataframe featuring all the sociodemographic variables, and a shapeFile for the spatial polygons (both of which are

Creating a SQL query using selectinput in R shiny

半世苍凉 提交于 2019-12-08 08:53:57
问题 I am trying to create a dynamic query using select input. Something like Select * from basket where fruits in("apple","banana","cherry") I have a table called fruit_list which populates my selectinput box. selectInput("fruit_list", label = h5("Select fruit"), multiple = T, choices = (dbGetQuery(conn, "SELECT fruit from fruit_list');"))) So far, when i renderprint my selection I get "apple" "banana" "cherry" I need a comma between the elements to get "apple","banana","cherry" When i choose a

R Shiny saving reactive ggplots

房东的猫 提交于 2019-12-08 08:23:22
问题 I'm trying to figure out how to save reactive ggplots in my R Shiny project. I've followed this guide as well as the guide on the R Shiny website. However, I think I may be having an issue since I'm using reactive plots. Here is the code I have so far. ui <- fluidPage( dashboardBody( fluidRow(uiOutput('topbox')), fluidRow( tabBox( id = 'tabset1', width = '100%', tabPanel('Grades Graph', downloadButton('Download'), plotOutput('individualGraph')), ) ) ) ) server <- function(input, output,

When to use a reactive expression vs to use <<- to create a global object

浪尽此生 提交于 2019-12-08 06:24:37
问题 I am trying to create a Shiny app using some functions that my coworker created. He often uses the '<<-' operator in his functions to create global objects. Questions: 1. Is it a good practice to use <<- in this case? 2. Will the app be faster if I use reactive() to represent the objects? 3. Any better suggestions? Here is an example of the function he wrote: PrepareData<-function(pickoneperday=TRUE,data) { set.seed(1) if (pickoneperday==TRUE) {data <<- PickOnePerDay(data)} data <<- RankData

How to set an initial value for two dependent input values (Slider and Numeric) in shiny?

假如想象 提交于 2019-12-08 04:20:03
问题 I have achieved to define two interconnected or mutually dependent input in my shiny app. Right now, my problem is to set a specific initial value for these slider and numeric inputs. It seems that they always start with the minimum value, even I don't now exactly why. How can I indicate a unique starting point or an initial value for these input parameters? I have attached a simplified part of my app in order to provide you a reproducible version of my problem here: " ui.R " library(shiny)

R Shiny saving reactive ggplots

拜拜、爱过 提交于 2019-12-06 16:07:58
I'm trying to figure out how to save reactive ggplots in my R Shiny project. I've followed this guide as well as the guide on the R Shiny website. However, I think I may be having an issue since I'm using reactive plots. Here is the code I have so far. ui <- fluidPage( dashboardBody( fluidRow(uiOutput('topbox')), fluidRow( tabBox( id = 'tabset1', width = '100%', tabPanel('Grades Graph', downloadButton('Download'), plotOutput('individualGraph')), ) ) ) ) server <- function(input, output, session) { grades <- reactive({ req(input$file) inFile <- input$file if (endsWith(inFile$name, '.xlsx')){

dynamically list 'choices' for selectInput from a user selected column

落爺英雄遲暮 提交于 2019-12-06 13:23:09
问题 Listing choices for selectInput() is done by hardcoding the values, as in the example from ?selectInput : selectInput(inputID = "variable", label ="variable:", choices = c("Cylinders" = "cyl", "Transmission" = "am", "Gears" = "gear")) However, I'd like my list of choices to be a unique listing of values from a user-selected column coming from a file (csv) uploaded by the user. How might I do this? This is as far as I've gotten: UI shinyUI(fluidPage( fluidRow( fileInput('datafile', 'Choose CSV

Login Screen For My Shiny App Does Not Time Out

孤者浪人 提交于 2019-12-06 08:04:52
问题 I have a shiny app where I have added authentication. The app is hosted on shinyapps.io and I have a few clients using the app. However, one client does not close his browser tabs, leaving the login page idle. I have found out that the login page does not time out. It remains idle and constantly eats up my active hours. Here is what my shiny app logs look like plus the front authentication page. I am using the shinymanager package. I have set the shiny app settings to time out after 10

Login Screen For My Shiny App Does Not Time Out

左心房为你撑大大i 提交于 2019-12-04 12:36:50
I have a shiny app where I have added authentication. The app is hosted on shinyapps.io and I have a few clients using the app. However, one client does not close his browser tabs, leaving the login page idle. I have found out that the login page does not time out. It remains idle and constantly eats up my active hours. Here is what my shiny app logs look like plus the front authentication page. I am using the shinymanager package. I have set the shiny app settings to time out after 10 minutes of being idle. This works great if you are logged in. However, when you are not, it does not time out