Shiny

R Shiny - Using Selectinput as column selection to subset data frame

♀尐吖头ヾ 提交于 2021-01-28 11:10:00
问题 I am using Shiny that takes in a user's txt file. The files composition is completely up to the user - there are no set headers for the file. data_vals <- reactive({ file1 <- input$file1 if (is.null(file1))return(NULL) read.table(fill=TRUE,file=input$file1$datapath, header=TRUE, colClasses = "factor")}) From this file, I create a drop down list from the header file that the user submitted: observe({ req(input$file1) dsnames <- names(data_labels()) cb_options <- list() cb_options[dsnames] <-

R reactiveFileReader reading from aws s3 bucket

岁酱吖の 提交于 2021-01-28 11:08:53
问题 I can read a csv from my S3 bucket using the below code aws.s3::s3read_using(read.csv, stringsAsFactors=FALSE, check.names=FALSE, object=paste0(Sys.getenv("BUCKET_PREFIX"), "/a.csv"), bucket = Sys.getenv("AWS_BUCKET_NAME"), opts=bucket_opts ) I want to change this to using the function reactiveFileReader. I tried the below with no success, any idea what I am doing wrong? reactiveFileReader( intervalMillis = 10000, session= session, filePath = paste0(Sys.getenv("BUCKET_PREFIX"), "/a.csv"),

R reactiveFileReader reading from aws s3 bucket

£可爱£侵袭症+ 提交于 2021-01-28 11:04:51
问题 I can read a csv from my S3 bucket using the below code aws.s3::s3read_using(read.csv, stringsAsFactors=FALSE, check.names=FALSE, object=paste0(Sys.getenv("BUCKET_PREFIX"), "/a.csv"), bucket = Sys.getenv("AWS_BUCKET_NAME"), opts=bucket_opts ) I want to change this to using the function reactiveFileReader. I tried the below with no success, any idea what I am doing wrong? reactiveFileReader( intervalMillis = 10000, session= session, filePath = paste0(Sys.getenv("BUCKET_PREFIX"), "/a.csv"),

filtering data reactively to generate maps

纵然是瞬间 提交于 2021-01-28 11:01:57
问题 In working with a map in shiny using mapview , I've been flummoxed by reactives and trying to make my map dynamically update. Here is a reproducible example that doesn't work properly, despite being designed using principles from other SO answers: # # This is a Shiny web application. You can run the application by clicking # the 'Run App' button above. # # Find out more about building applications with Shiny here: # # http://shiny.rstudio.com/ # library(shiny) library(sf) library(mapview) #

Stop the right sidebar in shinydashboardPlus from hiding the body of the app

╄→гoц情女王★ 提交于 2021-01-28 10:55:50
问题 is it possible to stop the right hand sidebar in shinydashboardPlus from hiding part of the main body the app? The default behaviour for a regular left sidebar panel is not to hide any part of the main body of the app. For example, in the below the left sidebar is clicked and the plot is moved to the right (you can see all parts of the plot). With the right sidebar panel is clicked this behaviour does not happen (see below screenshot). The sidebar is clicked and the plot is partially hidden

Filter data frame in Shiny app

怎甘沉沦 提交于 2021-01-28 09:49:07
问题 I'm trying to filter a data frame with user input as radio buttons. Unfortunately, only one type of filter works (the "Annual" version in my example), but the "Monthly" and "Quarterly" options are not returning anything. Here is my sample data set and code. # sample data mydf <- data.frame("Data"=rnorm(12), "Months"=c("Jan", "Nov", "Dec", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct")) library(shiny) library(dbplyr) ui <- fluidPage( # Input() function radioButtons(inputId =

R shiny error: Error in html tools::validateCssUnit(height); CSS units must be a single-element numeric or character vector

偶尔善良 提交于 2021-01-28 09:13:49
问题 Am learning to use R shiny and I am trying to create a heatmap that allows the user to specify the height in plotlyOutput to prevent labels from being clumped together. My minimal working code: library(shiny) library(plotly) ui <- fluidPage( titlePanel("Heatmap"), sidebarLayout( sidebarPanel( sliderInput("mapHeight", "Heatmap Height", min = 500, max = 1000, value =500), sliderInput("L", "left adjust", min = 0, max =900, value = 80) ), mainPanel(plotlyOutput("heatmap")) ) ) server <- function

Applying a function which takes in values and return the results from a data frame using Shiny

妖精的绣舞 提交于 2021-01-28 08:58:30
问题 I am trying to develop an app which asks the user for some values, passes these values to a function and outputs the results to a table in Shiny. The R code I have is the following: someFunction <- function(S, K, type){ # call option if(type=="C"){ d1 <- S/K value <- S*pnorm(d1) - K*pnorm(d1) return(value)} # put option if(type=="P"){ d1 <- S*K value <- (K*pnorm(d1) - S*pnorm(d1)) return(value)} } SInput <- 20 KInput <- 25 Seq <- seq(from = KInput - 1, to = KInput + 1, by = 0.25) C <-

How to change the display attributes of SPECIFIC tabs when using tabPanel in navbarPage

与世无争的帅哥 提交于 2021-01-28 08:20:48
问题 In this example, library(shiny) ui <- fluidPage( tags$style(type = 'text/css', HTML('.navbar {background-color: red;}')), navbarPage("", tabPanel("Tab 1", icon = icon("user")), tabPanel("Tab 2", icon = icon("cog")), tabPanel("Tab 3", icon = icon("sliders")) ) ) server <- function(input, output, session) { } shinyApp(ui, server) I would like Tab 3 to be special such that it appears different from the rest for: background-color + font-color when not hovered and not selected background-color +

How to put shiny radioGroupButtons into columns

三世轮回 提交于 2021-01-28 07:12:50
问题 I'd like to align some radioGroupButtons() from shinyWidgets into 5 equally spaced columns. I'd also like the buttons to all have the same width. The column widths work a little better if I use direction = "vertical" but the columns end up even further away from each other. Here's what it looks like as-is. Maybe the answer is hidden here but I couldn't figure it out. library(shiny) library(shinyWidgets) my_css <- ".btn-group, .btn-group-vertical { column-count: 5; }" ui <- fluidPage( tags