Menu
  • HOME
  • TAGS

Reactive input?

r,shiny

Dynamically create the numericInput rm(list = ls()) library(shiny) library(shinydashboard) ui <- dashboardPage( dashboardHeader(), dashboardSidebar(radioButtons("Output", "Continuous or binary:", c("Continuous" = "Continuous", "Binary" = "Binary"), selected = "Continuous"), uiOutput("test")), dashboardBody() ) server <- function(input, output) { output$test <- renderUI({ if(input$Output=="Continuous") { numericInput("sigma_y", "SD of y:", 0.1,min = 0, max = NA, step...

Is there a way to center an R plot within a tabPanel in shiny?

r,shiny,shinyapps

I am not aware of any Shiny specific way but you can always use css to style output images. Just add tags$style with a following content to your UI: "#plot1 img, #plot2 img { width: 60%; display: block; margin-left: auto; margin-right: auto; }" and remove width="60%" from plotOutput. Excluding width...

Reactively changing colour of an infobox, upon a click or hover over

javascript,html,r,shiny

What you want to do can be completely done with CSS and JavaScript, not shiny. Here is one possible solution (there are many ways to achieve what you want). Any info box you hover over will change to gray and when you click it will change to a different gray....

Alternate control of a sliderInput between a derived value and user selected value

r,shiny,data-visualization

I believe this is the code you want. It's not too complicated, I hope it helps new_customers <- data.frame(age=c(30, 35, 40), score=c(-1.80, 1.21, -0.07)) historic_customers <- data.frame(age=sample(18:55, 500, replace=T), score=(rnorm(500))) server <- function(input, output, session) { get_selected_customer <- reactive({ new_customers[input$cust_no, ] }) observe({ cust <- get_selected_customer() updateSliderInput(session, "age", value =...

In Shiny for R, why does Sys.Date() return yesterday's date inside a dateInput?

r,date,input,shiny

That does sound weird. I am just starting on Shiny so do not know for sure. COULD IT BE Timezone?? Maybe Sys.timezone() is different on their servers? Have you tried formatting the date for your timezone? Caching problem?? Could the value be cached from an old instance? But I take...

Forecasting an Arima Model in R Returning Strange Error

r,time-series,shiny,forecasting

The issue wound up being that I was using the arima(...) function instead of Arima(...). It turns out that they are two different functions. The issue that I was experiencing was a result of differences in how the functions store their data. More information about this can be found in...

Deploying R shiny app using leaflet

r,shiny,leaflet

It's a workaround but it worked for me today, when I was deploying an app myself: When I tried to deploy a shinyApp from inside a standard .R File from Rstudio, I got the same error message as you when I clicked on the "Publish" button. However when I embedded...

Handling `'createWebDependency' is not an exported object from 'namespace:shiny'` error in Leaflet Shiny

leaflet,shiny

According to THIS thread you might need to update your shiny version. If that doesn't help, could you add your output from "sessionInfo()" ?

need finite 'xlim' values using reactive function in Shiny

r,shiny,linear-regression

Your data function runs the first time when your shiny app starts. Because the input file is missing it will return NULL. But Your plotting function doesn't test its input and is equivalent to plot(NULL) in this case. If you test for an input !is.null() it should work: output$contents <-...

Shiny - years input only?

r,shiny,shinyapps

If you don't need months and days, then I'd argue that what you want is not dates but just year. If you just want year, then I would use a selectInput instead of a dateInput. Usually dateInput are used when you literally want a full date, but it makes a...

Shinydashboard dashboardSidebar Width Setting

css,r,width,shiny

The width of the sidebar is set by CSS on the .left-side class, so you could do: dashboardPage( dashboardHeader(title = "My Dashboard"), dashboardSidebar( tags$style(HTML(" .main-sidebar{ width: 300px; } ")),selectInput("id","Select a survey",choices=c("Very very very very long text","text"))), dashboardBody() ) ...

R - Shiny Package - Non-numeric argument to binary operator

r,shiny

When using reactive, the resulting enclosures need to be called as functions. See ?reactive. Instead use: data <- c(data(), visualisatie(), price(), self()) BTW: there are a couple of neater (as in "clean code") methods of doing your conversion: data <- reactive({ switch(input$data, "Onbelangrijk" = 1, "Minder belangrijk" = 3, "Neutraal"...

dplyr multiple inputs from Shiny

r,shiny,dplyr

Principal == input$selectPrincipal | input$selectPrincipal == "All" ...

Running various Shiny Apps in the same RStudio Server session

shiny

As nobody answered, I post what I found several days after: One solution is to open a shell and use the commands "R ..." or "Rstudio ..." depending on the system, in order to run whatever script you want. Another solution (what I finally did) was to set a webpage...

Widget position when using rmarkdown for shiny

r,shiny

You can get two sliders side by side using fluidRow and column. Just replace the sliderInput section of your code with the following: fluidRow( column(6, sliderInput("MeasA_L", label = "Measure A lower bound:", min=2, max=9, value=3, step=0.1) ), column(6, sliderInput("MeasA_U", label = "Measure A upper bound:", min=2, max=9, value=8, step=0.1) )...

R Shiny list2env

r,shiny

The environment() function will return the current environment. Thus if you use it inside a function, it will return the function's environment. You can then use that with list2env(lst, envir=environment()) (Although personally I almost always find it easier to keep data in a list rather than create a bunch of...

Why mutate applied only to first row and repeats its result to the rest

r,shiny

You can use separate or extract from tidyr library(tidyr) separate(d1, date_created, c('month', 'day', 'year'), remove=FALSE) Or extract(d1, date_created, c('month', 'day', 'year'), '([^-]+)-([^-]+)-([^-]+)', remove=FALSE) Or cSplit from splitstackshape library(splitstackshape) cSplit(d1, 'date_created', sep="-", drop=FALSE) Or using tstrsplit from the devel version of data.table library(data.table)#v1.9.5 setDT(d1)[, c('month', 'day', 'year') := tstrsplit(date_created, '-')] Regarding...

Shiny error is.na() applied to non-(list or vector) of type 'NULL'

r,shiny

You have a sintax error in the select input id! ("Marka" and "Model" with capital letter) selectInput("Marka", "Wybierz markę", levels(dane$Marka), levels(dane$Marka)[1]), selectInput("Model", "Wybierz model", levels(dane$Model), levels(dane$Model)[1]) ...

Dependent inputs in Shiny application with R

r,shiny

An example of updateSliderInput in shiny rmd --- title: "Dependent Inputs" runtime: shiny output: html_document --- ```{r} sliderInput("n", "n", min=0, max=100, value=1) sliderInput("n2", "n2", min=0, max=100, value=1) observe({ updateSliderInput(session, "n", min=input$n2-1, max=input$n2+1, value=input$n2) }) ``` ...

Leaflet map legend in R Shiny app has doesn't show colors

r,shiny,leaflet

I was able to make the colors showing up by changing the way I was referencing the values column in the arguments of the AddLegend function. I put the stat.selected variable in double brackets, which seemed to fix the problem: addLegend(position = "bottomleft", pal = pal, values = shp.data()[[stat.selected]], title...

How to set ggvis to use canvas renderer by default?

r,shiny,ggvis,shinyapps

Set renderer to canvas in set_options: library(ggvis) mtcars %>% ggvis(~wt, ~mpg) %>% layer_points() %>% set_options(width = 300, height = 200, padding = padding(10, 10, 10, 10), renderer = "canvas") ...

How do I select all, when the last selection is deselected in R / Shiny?

r,shiny

That is not the correct way to check if an element of a list is NULL. Your way returns logical(0) which when evaluated in the if statement throws the error you got. The correct way is is.null(), which either returns TRUE or FALSE. > test <- list(foo=1) > is.null(test$bar) [1]...

R Shiny - how to share variables between Rendering functions?

r,shiny,shinyapps

You could create another reactive function that returns a list, like this: shinyServer( function(input, output, session) { site <- reactive({ unlist(list("site1" = input$site1, "site2" = input$site2, "site3" = input$site3, "site4" = input$site4)) } output$text <- renderUI({ site = site() }) output$plot = renderPlot({ site = site() }) }) Then you...

How to build a 'for' loop with input$i in R Shiny

r,loops,for-loop,shiny

Use [[ or [ if you want to subset by string names, not $. From Hadley's Advanced R, "x$y is equivalent to x[["y", exact = FALSE]]." ## Create input input <- `names<-`(lapply(landelist, function(x) sample(0:1, 1)), landelist) filterland <- c() for (landeselect in landelist) if (input[[landeselect]] == TRUE) # use `[[`...

Shiny - how to change the font size in select tags?

r,shiny,shinyapps

You had the right idea, but the select input in shiny actually uses selectize JavaScript to show the UI instead of the traditional select HTML tag. That's why your CSS isn't catching. What you want instead of the select CSS is ".selectize-input { font-size: 32px; } However, if you only...

how to set Shiny::toJSON args from custom update***Input function?

r,shiny,inputbinding

You can simply pre-encode your R data using jsonlite::toJSON() and pass the encoded JSON string to shiny. It will be treated as a verbatim JSON string instead of being double-encoded (e.g. "[1,2]" will not be encoded again as "\"[1,2]\""). This is due to the fact that we used the argument...

R Shiny - set reactive width of a plot output

plot,shiny,reactive-programming,weight

there should be 70*nrow(labelSub()) instead 70*ncol(labelSub()) Thanks to Joe Cheng from shiny discuss group https://groups.google.com/forum/#!topic/shiny-discuss/hW4uw51r1Ak

Disable textInput based on radio button selection on Shiny

r,shiny

You could do this with session$sendCustomMessage on the server (which generates javascript that disables or enables the text box) and Shiny.addCustomMessageHandler in the UI (which executes the javascript). library(shiny) ui <- fluidPage( tags$head(tags$script(HTML(' Shiny.addCustomMessageHandler("jsCode", function(message) { eval(message.code); } ); '))), column(3, radioButtons("radios", "", c("Enabled" = "enabled", "Disabled" = "disabled"), inline...

Save changes to sqlite db via shiny

sqlite,shiny,shinyapps

Yes. It is possible and here is an example: Create a simple db: library(RSQLite) con <- dbConnect(SQLite(), dbname="sample.sqlite") dbWriteTable(con, "test", data.frame(value1 = letters[1:4], value2 = letters[5:8])) dbDisconnect(con) Shiny App: library(shiny) library(RSQLite) runApp(list( ui = bootstrapPage( textInput("value1", label = "Value 1"), textInput("value2", label = "Value 2"), actionButton("action", label = "Write to...

Reactive subset in ddply for rmarkdown shiny

r,shiny,subset,rmarkdown

First, you are trying to modify a reactive object outside the reactive expression. I would suggest to define column names inside the expression. Second, I don't think that modifying bc()$Yield is an authorized operation. So I would try do generate Yield also inside a reactive expression. Below is an edited...

Create interactive webmap with markers in R using Shiny, Leaflet and rCharts

r,maps,leaflet,shiny,rcharts

I figured it out myself eventually! Another post (Shiny renders a responsive rCharts leaflet map once, but is blank if you change the input variable) indicated that the line of code "map$set(dom='myChart')" could be preventing Leaflet from reloading a new map on each selection. I didn't think that could be...

Disable rCharts animations

r,highcharts,shiny,rcharts,polychart

I am not a heavy user of Polycharts and Highcharts, so if you could add an example it would be helpful. For NVD3 the variable is called transitionDuration. An example of a chart without animations would be as follows: library(rCharts) hair_eye = as.data.frame(HairEyeColor) p2 <- nPlot(Freq ~ Hair, group =...

Error in UseMethod(“xtable”)

r,shiny

You simply reduce a wrong thing. Assuming you have only two files 'file1.csv', 'file2.csv' but it should work with larger number of files as well: > write.csv(structure(list(id = 1:3, x = 4:6), .Names = c("x", "y"), class = "data.frame", row.names = c(NA, -3L)), 'file1.csv', row.names=FALSE) > write.csv(structure(list(id = 1:2, y...

Limiting the number of users in a locally hosted R shiny app

r,shiny

I wouldn't recommend doing this, I think it's very dangerous, but there are ways you could hack this together. Here's one solution (as I said, it's hacky and I wouldn't do it myself). The basic idea is to have a global variable that keeps track of whether or not someone...

Creating a generic function generating new objects from selected list of columns in a data frame

r,function,user-interface,shiny,shinyapps

There's several ways to write the function you want. Here's an example of such a function that accepts a dataset and a column name and creates the associated select input. mySelectInput <- function(data, col) { id <- sprintf("select_%s", col) label <- sprintf("Select %s", col) choices <- sort(unique(data[[col]])) selectInput(id, label, choices)...

Custom play button for slider input in Shiny?

r,shiny

playButton is not an argument to sliderInput. Instead, playButton is an argument to animationOptions which is used for animate argument of sliderInput. See here for details: http://shiny.rstudio.com/reference/shiny/latest/sliderInput.html However, I tried setting up a custom play button in this manner and it did not work. You may need to just write...

Shiny & ggvis select subset of data dynamically

r,shiny,ggvis

Your code has a few problems and doesn't run... why are you returning from the main server function? And you're using two variables dataFiltered and rawData that aren't defined anywhere. Here is the solution of what you're trying to do runApp(shinyApp( ui = fluidPage( uiOutput("choose_dataset"), ggvisOutput("plot1") ), server = function(input,...

[r][shiny] how to render ui from a string?

r,shiny

First of all, very cool idea. Your code's problem is actually not in your eval parse method, but in your numeric input arguments. They are missing a value and label input. Try: server.R chr <- "numericInput(inputId='a', value = 1, label = 1)" shinyServer(function(input, output, session) { output$ui <- renderUI({ eval(parse(text=chr))...

R Shiny - filter two table and heatmap simultaneously (with cells of fix width)

r,callback,filtering,shiny

Finally me and Joe Cheng (whom I want to thank very much) implemented following solution. https://groups.google.com/forum/#!topic/shiny-discuss/hW4uw51r1Ak f <- function () sample(seq(1:10), 25, replace=TRUE) in1 <- cbind (f(), f(), f(), f(), f(), f()) label <- data.frame(L1= c(rep("A", 5), rep("B", 5), rep("C", 5), rep("D", 5), rep("E", 5)), L2=(sample(c("M", "FFF"), 25, replace=TRUE)), ID=seq(1,25))...

How to embed an image in a cell a table using DT, R and Shiny

r,shiny,shiny-server

You can use the escape = FALSE in your DT call, as per: https://rstudio.github.io/DT/#escaping-table-content # ui.R require(shiny) library(DT) shinyUI( DT::dataTableOutput('mytable') ) # Server.R library(shiny) library(DT) dat <- data.frame( country = c('USA', 'China'), flag = c('<img src="test.png" height="52"></img>', '<img src="http://upload.wikimedia.org/wikipedia/commons/thumb/f/fa/Flag_of_the_People%27s_Republic_of_China.svg/200px-Flag_of_the_People%27s_Republic_of_China.svg.png" height="52"></img>' ) )...

R/Shiny WebApp logs, running in shell (Ubuntu crontab)

r,ubuntu,logging,shiny,crontab

I have been searching in the web and I didn't find any solution. Instead, I changed the philosophy. I generated myself some logs from inside the Shiny app with the help of the sink() function. Thank you....

How can I make the width of an image in a Shiny app dynamic?

css,r,image,shiny

You can style the image using css tag as below: shinyUI(bootstrapPage( titlePanel("Sidebar Image App"), tags$head(tags$style( type="text/css", "#image img {max-width: 100%; width: 100%; height: auto}" )), sidebarPanel( imageOutput("image") ) )), where css id selector (here #image) should correspond to the outputId of the imageOutput....

rCharts doesn't render the plot in shiny app

r,plot,shiny,rcharts

Hi you use the wrong JS library, it's morris, not polycharts, try : # ui.R library(shiny) library(rCharts) ui<-fluidPage( headerPanel("Economics data with rCharts"), mainPanel( showOutput("myChart","morris") ) ) # server.R library(shiny) library(rCharts) require(datasets) server<-function(input,output){ output$myChart<-renderChart2({ data(economics, package = 'ggplot2') econ <- transform(economics, date = as.character(date)) m1 <- mPlot(x = 'date', y =...

Convert a column of text URLs into active hyperlinks in Shiny

r,url,hyperlink,datatables,shiny

You need to do two things: Modify the last column so that the KEGGLINK is changed into a proper HTML link that looks like: <a href='url'>link text</a>. Pass DT the escape = FALSE argument so that it doesn't escape the HTML code. The DT web page has an example of...

Shiny - How to Style a Selected Radio Buttons Label?

css,r,shiny

I ended up changing the R code to put in a class called radioSelect: column(6, h1(class="radioSelect", radioButtons(inputId="gender", "Gender", choices = list(... and then in the CSS file, I accessed the labels with: .radioSelect label.radio { ... This worked since the labels all have the class 'radio' on them. Thus I...

reactive + serverside Shiny datatable with extensions?

r,asynchronous,shiny

When the data argument of DT::datatable() comes from a reactive expression, the datatable() must be put inside renderDataTable(). renderDataTable({ action = dataTableAjax(session, dataSel4counts()) datatable(dataSel4counts(), server = TRUE, options = list( ajax = list(url = action) )) }) That will fix the error. Regarding the warning message, I have no idea...

Cannot produce ggplot2 in Shiny

r,ggplot2,shiny,ecdf

You have a reactive data set in datasetInput but you aren't using it in your plotting function. In your ggplot call just replace mydf_m with datasetInput(). I also replaced renderGvis with renderPlot and return the data from the reactive datasetInput. The server is then server <- shinyServer(function(input, output) { datasetInput...

using dygraph with shiny

r,shiny,dygraphs

Since you need the input data in server.R (for the graph) and in ui.R (for the input list), I added a renderUI({...}) in server.R and an uiOutput(...) in ui.R # server.R library(shiny) library(dygraphs) library(dplyr) library(xts) shinyServer(function(input, output) { data <- read.csv("cleanApples.csv") %>% filter(Quantity > 10) #the first graph which is...

Shiny + GGplot - mouse click coordinates

ggplot2,shiny,rstudio

I find a way to resolve: imagens and codes: https://github.com/faustobranco/StackQuestions library(shiny) library(ggplot2) ui <- fluidPage( plotOutput("plot", click = "plot_click"), verbatimTextOutput("info") ) server <- function(input, output, session) { output$plot <- renderPlot({ ggplot(cars, aes(speed, dist)) + geom_bar(stat="identity") }) output$info <- renderText({ xy_str <- function(e) { if(is.null(e)) return("NULL\n") paste0("x=", round(e$x, 1), "\n") }...

using a trycatch block to read a csv and an excel file

r,excel,csv,shiny,shiny-server

I think you would actually be best served implementing a switch statement. That way you don't waste computation time trying to read a file as a csv when it is not. You also probably want a fall back option in case someone uploads a file that is neither a csv...

How do I reference a clicked point on a ggvis plot in Shiny

function,shiny,ggvis

Here's a working solution that just prints out the data.frame. You're close. df <- data.frame(a = 1:5, b = 101:105) runApp(shinyApp( ui = fluidPage( ggvisOutput("ggvis") ), server = function(input, output, session) { clickFunc <- function(data, location, session) { cat(str(data)) } df %>% ggvis(~ a, ~b) %>% layer_points %>% handle_click(clickFunc) %>%...

HTML page which takes the input, runs the R code and gives the result back to HTML

html,r,shiny,knitr,rmarkdown

library(shiny) library(dplyr) server <- function(input, output) { file1 <- read.csv("/Users/Desktop/unspscList.csv", sep=",", header=TRUE) CName <- levels(file1$Commodity_Name) CName.lower <- tolower(CName) correct_1 <- function(thing){ scores = stringdistmatrix(tolower(thing), CName.lower, weight=c(1,0.001,1,0.5)) if (min(scores)>2) { return("UNKNOWN") } else { return(as.character(CName[which.min(scores)])) } } classify <- function(thing) { result <- file1 %>% filter( tolower(Commodity_Name) ==...

evaluate function in shiny and print values

r,shiny

You can prepare output inside server function like this: server <- function(input, output) { output$df1 <- renderUI({ df <- my.func(input$slider) lapply( 1:ncol(df), function(i) { force(i) p(paste("Value", i, "is", df[, i])) } ) }) } and then bind in inside ui function using uiOutput('df1'). Alternatively you can use observe block and...

dplry in reactive function for shiny app using rmarkdown

r,shiny,dplyr

A reactive is not a function and you cannot pass arguments to a reactive. Your function countFunc should be a function, not a reactive. Then you call the function with the appropriate (reactive) values. countFunc <- function(x, ml, mu) sum( (x > ml) & (x < mu) ) totals <-...

How to make the horizontal scrollbar visible in DT::datatable

r,datatables,scrollbar,shiny,horizontal-scrolling

I don't think you can (or should) force a scrollbar easily if you don't need one, but the above code works fine for me, it shows a scrollbar when the page initializes. Maybe the problem is with the data or something else. Here's a minimal example that has a horizontal...

The error when publishing a shiny app

r,shiny,rstudio,shinyapps

As the error message says, please install shinyapps from https://github.com/rstudio/shinyapps It is not a package on CRAN, so you cannot install.packages().

Manage paths in R Shiny?

r,shiny,web-deployment

For tidiness I keep my source files in a folder called "files" alongside ui.r and server.r. Since the working directory for a shiny app is the folder where ui.r and server.r are kept you can use source("files/script.r").

Shiny “updateCheckboxGroupInput” inconsistency

shiny,shinyapps

When you use the updateCheckboxGroupInput you still have to provide what goes in there. rm(list = ls()) library(shiny) choices <- letters[1:5] runApp(list( ui = basicPage( checkboxGroupInput('chkGrp', 'Options', choices), actionButton("all","All"), actionButton("none","None"), verbatimTextOutput("value") ), server = function(input, output, session) { output$value <- renderPrint({ input$chkGrp }) observe({ if ( is.null(input$all) || input$all ==...

How to upload/import a file in the new R shiny version 0.12 using DT package

r,datatable,upload,shiny

Your code is fine. Are you sure you're updated to the absolute latest shiny and DT? Both of them have been updated pretty heavily the past couple weeks, so make sure you install their GitHub version. I would guess that one of the packages is not up to date. Note...

Filter data frame for use in multiple renderPlot functions

r,shiny

You can wrap the filtering of the data frame in a reactive expression and the call filter_df() in each of the data argument of your plots: filter_df <- reactive({ df %>% filter(person==select()) }) ...

R shiny updateCheckboxInput

r,shiny

Because it takes a few milliseconds since you tell shiny to update the input until it actually happens. When you call the update method, shiny has to send a message to JavaScript to change the value of the input, and once that's done, JavaScript sends a message back to R...

R shiny ggplot2 error 'Results must be all atomic, or all data frames'

r,ggplot2,shiny,shinyapps

It seems to be a problem with plyr, which is probably going to get fixed in the next R update. Until then you can fix it following these steps: Install platform specific development tools: Windows: Download and install Rtools33.exe from http://cran.r-project.org/bin/windows/Rtools/ Ubuntu or Debian based Linux: sudo apt-get install r-base-devel...

Using filtered datatables in shiny

r,filter,datatable,datatables,shiny

Just building up on @JasonAizkalns's example, you can hide some of the built-in column filters using jQuery. for example here the first two are hidden: library(shiny) library(DT) shinyApp( ui = fluidPage(dataTableOutput('tbl'), plotOutput('plot1')), server = function(input, output) { output$tbl = renderDataTable({ datatable(iris, filter="top",options = list(lengthChange = FALSE),callback=JS(" //hide column filters for...

Changing the color of the sliderInput in Shiny walkthrough

css,r,shiny

Follow the tutorial here to create a CSS file within a folder called www as a sub folder of the folder with your shiny app in it. The contents of this file should be: .js-irs-0 .irs-bar { border-top-color: #d01010; border-bottom-color: #d01010; } .js-irs-0 .irs-bar-edge { border-color: #d01010; } .js-irs-0 .irs-single,...

Shiny - change the size (padding?) of dropdown menu (select tags) smaller

html,css,r,shiny,shinyapps

For the dropdown options, it's line-height that you want (the padding is already 0 by default I think, look at the CSS on it using the chrome debugger). For the box itself, it looks like bootstrap is placing a min-height on it, so you also need to add min-height: 0;....

Shiny - custom warning/error messages?

r,shiny

As we need to return plot to renderPlot() we need to display the error/warning within plot() function. We are plotting a blank scatter plot with "white" colour, then adding the error message with text() function in the middle - x=1, y=1 of the plot, see below working example: #dummy dataframe...

How to restrict Shiny fileInput to text files only?

shiny,rstudio

As far as I understand, that's the right way to do it. If you view your app in the RStudio viewer it wouldn't do anything, but in a browser it should. I'm using Chrome and I just ran that code and it did in fact only show me txt and...

how to get values from selectInput with shiny

r,shiny

You can simply use input$selectRunid like this: content(GET( "http://stats", path="gentrap/alignments", query=list(runIds=input$selectRunid, userId="dev") add_headers("X-SENTINEL-KEY"="dev"), as = "parsed")) It is probably wise to add some kind of action button and trigger download only on click....

Global assignment within a reactive expression in R Shiny?

r,null,shiny,variable-assignment

You should use reactiveValues() for this kind of need, because it allows you to create and modify your data at different stages in your app. Here is an example (not tested): values <- reactiveValues() observe({ inFile <- input$file if (!(is.null(inFile))){ values$data <- read.csv(inFile$datapath) } }) observe({ values$data[,input$deletecols] <- NULL })...

How to format currency values in valueBox shinydashboard?

r,shiny,currency,dashboard

Discovered the function prettyNum(): this function is amazing for simple conversion to comma separated numerics. > prettyNum(56789, big.mark = ",") > 56,789 ...

How can I use a variable to get an Input$ in Shiny?

r,variables,csv,shiny

input is just a reactivevalues object so you can use [[: print(input[[a]]) ...

Unable to appropriately assign a size to NVD3 chart

shiny,nvd3.js,rcharts,shinyapps

I tested your code and added the library argument nvd3 to the UI section like this: box(showOutput("distPlot2",'nvd3'),width = 6) to load the javascript library. I was able to adjust the width of the box on the ui side and/or the width of the chart on the server side.

submit input in text area using return without inserting a newline character

javascript,r,shiny

You should prevent default behavior, which is inserting a new line, before calling your function. if (event.keyCode == 13 && (event.metaKey || event.ctrlKey)) { event.preventDefault(); callback() } ...

How to implement a reset button in R shiny?

r,shiny

You may have stumbled upon some reserved variables? not sure, I saw a bunch of buggy behavior, but this works, just change the UI variable names too shinyServer(function(input, output,session) { output$dummyoutput <- renderText({NULL}) output$results1 <- renderDataTable({NULL}) observe({ input$compute1 output$results1 <- renderDataTable({ mytab <- data.frame( ID=1:10, blah=letters[1:10] ) print("computing") return(mytab) })...

Dynamic UI & Accessing Data (Shiny)

r,dynamic,shiny

After some discussion with AndriyTkach : I have a working program : output$PowerAnalysisANOVA <- renderPlot({ allmean = c() for (i in 1:values$numGroups) eval (parse (text = paste0("allmean[", i, "] <- input$group_" ,i))) qplot(allmean) }) And I had forgotten to make a reactive variable : values <- reactiveValues() output$hmgroupsmean <-renderUI({ values$numGroups...

Shiny script from Ubuntu bash

r,bash,ubuntu,shiny

To run code using R on shell, you must use the -e option, which stands for expression. The same thing can be done via Rscript. The correct syntax is then: R -e 'shiny::runApp(...)' Care must be taken with the quotes if there are any in the expression being used. For...

“Icon” (ISOTYPE) charts in R shiny with Javascript

javascript,r,plot,statistics,shiny

Answering my own question since, after all, I have found some resources that fit my use case and they seem viable for development. Hopefully it'll come in handy for the comunity later down the road :) After further investigation, I found the name of "pictogram charts" as an alternative way...

Sleep Shiny WebApp to let it refresh… Any alternative?

r,shiny,sleep

some reproducible code would allow me to give you some example code, but in the absence of that... wrap what you currently have in another if(), checking for length = 0 (or just && it, with the NULL check first), and display your favorite placeholder message....

R Shiny error when using shinyBS to disable actionButton if right-side of chooserInput is empty

r,button,shiny

In server.R, I replaced if(widget2_right == character(0)) with if(length(widget2_right)==0) and now the program works as I wanted it to. When the right-box is empty, widget2_right = character(0). I learned that comparing vectors to character(0) results in logical(0), not TRUE or FALSE. However, length(character(0)) = 0. Therefore, if(length(widget2_right)==0) will be TRUE...

R/ Shiny - How to get current year with Sys.Date()?

r,shiny,shinyapps

You can just use the format() function here as outlined in the help page for Sys.Date(). See ?strptime for all the different specifications: > c(2014, format(Sys.Date(), "%Y")) [1] "2014" "2015" If you actually need integer values, then: > c(2014L, as.integer(format(Sys.Date(), "%Y"))) [1] 2014 2015 ...

Shiny - submitButton and conditionalPanel [closed]

r,shiny,shinyapps

To fix the issue, do the following: Switch out the submit button and use an action button instead. Write an output using RenderUI to either show nothing if scatter or show the radiobutton if line plot. Modify #2 above so that its reference to input$plot is isolated and only updated...

Strange behavior of R Shiny reactiveValues() and invalidateLater()

r,shiny,shinyapps

According to this answer, this can be fixed by manipulating the CSS in ui.R tags$style(type="text/css", ".recalculating { opacity: 1.0; }" ) ...

Shiny: Input selection through conditional panels is overruled

shiny

Your problem is that both the radio buttons and the checkboxes are using the same ID. Both of them are using id variable. You can't have that. In HTML, every element must have a unique ID. Since you're defining the checkboxes first, they get to keep the ID and are...

Error when importing ggplot bubble chart into Shiny

r,ggplot2,shiny

Code seems to run from my side: I thus modified the following row: x<-c(0,g2[2:nrow(g2),3]*cos(angl*(pi/180))) Regards...

Use a reactive dataframe in Shiny to predict(svm)

r,shiny,shiny-server

I think I found the answer on Hack-R's github (which I found from a search here). https://github.com/hack-r/coursera_shiny I don't really understand the code, but I think I can cannibalize it to my full example. Thanks to user1269942 for the help, and to Hack-R for posting his finished product on git....

“read_excel” in a Shiny app

r,shiny,xlsx

This is an open issue with the readxl package. The current workaround provided there is to copy the file data path and append .xlsx. Here is a working example on my machine limited to .xlsx files edited to use file.rename instead of file.copy. library(shiny) library(readxl) runApp( list( ui = fluidPage(...

Sliders providing null values to complex shiny application at startup and periodically as inputs change

javascript,r,html5,null,shiny

On the shiny google group, I was informed that this is expected behavior. The inputs take time to load and you must define what inputs are required to be non-null to produce each given output. The solution here was to use the following in the relevant outputs: shiny::validate(need(input$myinput, message=FALSE)) It...

How to set scrollWheelZoom to false in a map using leaflet in Shiny?

r,leaflet,shiny

As stated by Yihui on the comment above, there is no way to do it. I filled an issue at leaflet to ask this feature: https://github.com/rstudio/leaflet/issues/84 Tks...

Hide shiny output

r,shiny,rmarkdown

You can use the shinyjs package to hide elements with the hide() function (or use the toggle() function to alternate between hiding and showing). Disclaimer: I wrote that package. I've never used it in an rmarkdown before, so I'm just going to show how to use it in a normal...

How can I display my plot without toolbars, in Shiny?

html,css,r,twitter-bootstrap-3,shiny

You didn't post your theme.css, but the issue is probably that the css overflow argument is set to scroll for the div holding the plots in you app's css. This forces scrollbars if the div is too small for its content. The default height for a plotOutput is set to...

Remove reactive expression in shiny app

r,shiny

This page should help you https://gist.github.com/wch/9606002. Basically, if you put an actionButton in your file, you can put an isolate bracket around your file input, so that the data won't changed each time an input is changed. Look at that page for more of the intricacies, but essentially you would...