Shiny

eval(parse(text=“f”)) on shinypass.io

China☆狼群 提交于 2020-01-17 05:01:06
问题 I want to write an app that lets the user enter a function using textInput, and then does something with the function. Here is a toy example: shinyUI(fluidPage( titlePanel("Test"), sidebarLayout( sidebarPanel( textInput("fun","function:",value="x") ), mainPanel( uiOutput("text") ) ) shinyServer(function(input, output) { findMax <- reactive({ f <- function(x) eval(parse(text = input$fun), envir = list(x)) x < seq(0,1,length=100) max(f(x)) }) output$text <- renderText( { findMax() }) }) )) and

Shiny R renderPrint in loop usinf RenderUI only update the output

孤街醉人 提交于 2020-01-17 04:54:07
问题 I am trying to dynamically render multiple text output from multiple text input. I tried to use this very helpfull example and this one too. This conversation is also helpfull. But when I try to adapt this examples on the following script, I have a problem of output update. Apparently, only the last element was read and updated. It's probably a reactivity problem but it seems to be difficult to associate reactive{()} and renderUI{()} functions. rm(list = ls()) library(shiny) creatDataElem <-

Passing user input in Shiny to a URL query string

最后都变了- 提交于 2020-01-17 03:15:10
问题 I have a question that I'm having trouble getting to work. I have a Shiny app that I want to accept two user input, send it back from ui.R to server.R, and insert that as a variable into a URL query string to download the file from a database. At first, we hardcoded the values to test the algorithm but we eventually want to make it user defined. I thought that saving as a variable and replacing it in the query string would work, but it didn't... I tried to concatenate pieces of the URL and I

Using the input from updateSelectInput

有些话、适合烂在心里 提交于 2020-01-17 02:23:07
问题 My problem is when selecting data using the input from "updateSelectInput". input$State and input$Company returns no values to my "data selection" function, input$Transport that is not an "update" works fine. How I call an input when using "updateSelectInput"? Does it work in the same way as "selectInput"? Thanks in advance! Here is the data I created to simplify the problem: Company<- paste('company',1:95) State<- paste('state',1:20) Transport<-c('inter long','nacional long','nacional short'

svg with clickable links in shiny - not clickable

大城市里の小女人 提交于 2020-01-17 00:39:13
问题 I am generating svg files in Shiny using graphviz dot. They have clickable links. I am doing it like this. imageOutput("imagegraph",width = "100%", height = "auto",inline=F) ... output$imagegraph <- renderImage({ ... list(src = svgGeneratedOnTheFlyByGraphviz.svg, align="top", width=wid, contentType="text/svg+xml" ) ) The problem is that although the actual image as viewed through "open image in new tab" does have the clickable links, within the div generated by Shiny, nothing is clickable.

Select different columns in renderTable

回眸只為那壹抹淺笑 提交于 2020-01-16 18:44:48
问题 I have a dataframe that is updated each time the user changes the year, let's call it mydata. In output, I'd like to have a table with the possibility to select columns to show, but I'd like the "choices" argument (in the checkboxGroupInput) to be different according the year. Short part of my current code : Ui : sliderInput("year","Choose the year",min=2013,max=2018,value=2017,step=1,sep=""), conditionalPanel(condition="input.year==2013", checkboxGroupInput("show_vars13", "Choose variables

Create dynamic number of card elements in shiny flowLayout

孤街浪徒 提交于 2020-01-16 18:40:37
问题 I like to fill an area in a shiny app with card elements. The items flow into the next row when there is not enough space. This can be achieved with flowLayout . But I do not know the number of items in advance, so I need to create the card elements in a loop. But when I use lapply inside flowLayout all elements are shown below each other. How to fix this, so that items are shown in rows next to each other? library(shiny) card <- function(.img, .species, .sepal.length) { HTML( paste0( '<div

Problem passing variable names via selectInput() in R/Shiny

筅森魡賤 提交于 2020-01-16 18:22:33
问题 I'm building a shinyapp where I am passing variable names as arguments to the server with the selectInput() widget. The following static example illustrates the plot that I want displayed: g <- ggplot(d, aes(y, fill = var1, colour = var1)) + geom_density(alpha=.2) Just to be clear, here is an image of the above plot What I want to do in my shinyapp is to separate the plotted distributions by different variables that the user can choose via selectInput(). But when I substitute var1 in the

Render rCharts using ReporteRs package in powerpoint

梦想与她 提交于 2020-01-16 13:18:08
问题 I can renderchart in R shiny by below code: output$example=renderChart2({ p1 <- nPlot(mpg ~ wt, group = 'cyl', data = mtcars, type = 'multiBarChart') p1 }) Now, I want the same thing in ppt. by using ReporteRs package.I have tried below code but it is not working library(ReporteRs) doc =pptx( ) doc <- addSlide(doc, "Two Content") plotFunc<- function(){ nPlot(mpg ~ wt, group = 'cyl', data = mtcars, type = 'multiBarChart') } doc <- addPlot(doc, fun =print, x = plotFunc) writeDoc(doc, "r-2.pptx"

How do I send multiple dySeries to a secondary axis based on checkbox input in shiny?

好久不见. 提交于 2020-01-16 09:03:14
问题 I'm trying to plot a dyGraph using the lungDeaths timeseries, but I want "mdeaths" and "fdeaths" to be on the secondary axis, if at least one of them is selected alongside "ldeaths". Here's a working example: global.R library(dygraphs) library(shiny) library(datasets) library(stringr) lungDeaths <- cbind(mdeaths, fdeaths) ui.R shinyUI(fluidPage( titlePanel("Predicted Deaths from Lung Disease (UK)"), sidebarLayout( sidebarPanel( id="sidebar", width = 3, div( checkboxGroupInput( inputId =