Shiny

“empty data message” in renderTable

会有一股神秘感。 提交于 2021-02-19 08:01:55
问题 I user renderTable to show some data. However, sometimes the data table is empty, in which case I'd like to print "No data to show" or something similar. the default by renderTable is to show nothing for empty data. can this be changed? how? 回答1: You can use a condition into a renderUi to render either a message or a "tableOutput" (you can't render directly the table) datas <- data.frame() shiny::runApp(list( ui = pageWithSidebar( headerPanel("Example"), sidebarPanel( selectInput("dataset",

R Shiny how to display a pdf file generated in “downloadHandler”

梦想的初衷 提交于 2021-02-19 07:37:59
问题 I am new to shiny and was wondering if there is a way to display a pdf file generated in "downloadHandler"? I am using a package to do some biological analysis, and I can make it create a pdf file in downloadHandler. However, I am still struggling if I can view this pdf instead of downloading it. This question is related to Shiny to output a function that generates a pdf file itself. Please see the below for the code that works for downloading the pdf output. Thanks so much! library(shiny)

R shiny remove UI keeps the label

你。 提交于 2021-02-19 07:34:10
问题 I am calling shiny removeUi() for an textInput, however, only the input section gets removed and not the label. See code and image below: clearElements <- function (dat) { observe({ for (el in dat) { id <- strsplit(el,substring(el, nchar(el)-8, nchar(el)))[[1]] print(id) removeElement(id) } }) } removeElement <- function (el_id) { removeUI( selector = paste0("#", el_id), multiple = TRUE, immediate = TRUE, session ) } Here is the visual result: 回答1: The accepted answer does not work. You need

R Leaflet PopupGraph - addPopupGraphs on map_marker_click

孤者浪人 提交于 2021-02-19 07:11:02
问题 I would like to open a popup with a unique plot for each of my marker in it on a map_marker_click using r leaflet and the leafpop library. For each point when the user click on them the plot to display is computed. Below is a reproductible code but it doesn't return any error. Any ideas? library(tidyverse) library(ggplot2) library(shiny) library(leaflet) library(leafpop) id <- c(1,1,1,1,2,2,3,3,3,4) lat <- c(49.823, 49.823, 49.823, 49.823, 58.478, 58.478, 57.478 , 57.478 , 57.478, 38.551) lng

R Leaflet PopupGraph - addPopupGraphs on map_marker_click

≯℡__Kan透↙ 提交于 2021-02-19 07:09:13
问题 I would like to open a popup with a unique plot for each of my marker in it on a map_marker_click using r leaflet and the leafpop library. For each point when the user click on them the plot to display is computed. Below is a reproductible code but it doesn't return any error. Any ideas? library(tidyverse) library(ggplot2) library(shiny) library(leaflet) library(leafpop) id <- c(1,1,1,1,2,2,3,3,3,4) lat <- c(49.823, 49.823, 49.823, 49.823, 58.478, 58.478, 57.478 , 57.478 , 57.478, 38.551) lng

Unzipping a file in R Shiny using unzip() fails when deployed

瘦欲@ 提交于 2021-02-19 06:49:29
问题 I'd like to unzip a compressed .mdb file in the www folder of my shiny app, query it for data, and then remove it. Unzip() works on my local machine, but when I deploy the app at shinyapps.io, it has issues unzipping the file. Because I'm not able to read.table() the resulting file (it's an .mdb) I don't think unz() will work. This code works when run on my local machine Server: require(shiny) shinyServer(function(input, output) { observeEvent(input$run,{ #Run Button dbName=unzip('www/test

Link R shiny selectInput item to open file actionButton

跟風遠走 提交于 2021-02-19 06:22:48
问题 Using R shiny, is it possible to link selectInput item to open file action button ? I would like to adapt onclick argument of action button to achieve it. Please find below a reproductible example: Supposing we have "file_1.pdf" and "file_2.pdf" on "www" folder, how can I open the file corresponding to select Input choice ? library(shinydashboard) library(shiny) ui <- dashboardPage( dashboardHeader(title = "Open file app"), dashboardSidebar(), dashboardBody( fluidRow( selectInput(inputId =

Deploy shiny with shinyproxy - no app showing

一个人想着一个人 提交于 2021-02-19 03:54:07
问题 I've developed a shiny app and i'm trying to do a first lightweight deploy using shinyproxy. All installation seems fine. I've installed docker, java. I thought that building a package that wraps the app and other function would be a good idea. So I developed a package (CI) and CI::launch_application is basically a wrapper around RunApp function of shiny package. This is the code: launch_application <- function(launch.browser = interactive(), ...) { runApp( appDir = system.file("app", package

plotly click events from anywhere on the plot

纵然是瞬间 提交于 2021-02-19 02:57:49
问题 I am new to r-plotly and trying to figure out how to handle clicks which are not on the data. It seems that using event_data("plotly_click") I get events that are on points from the data, but so far have not figured out how to do this for clicks which are not close to the data, but just on the white part of the plot. Shiny click events from plots can do this and I just get the x and y of the click. I want similar, but for plotly plots. Can I specify click events to be from anywhere on the

R shiny dynamic UI in insertUI

两盒软妹~` 提交于 2021-02-19 02:24:05
问题 I have a Shiny application where I would like to add a UI element using an action button and then have that inserted ui be dynamic. Here is my current ui file: library(shiny) shinyUI(fluidPage( div(id="placeholder"), actionButton("addLine", "Add Line") )) and server file: library(shiny) shinyServer(function(input, output) { observeEvent(input$addLine, { num <- input$addLine id <- paste0("ind", num) insertUI( selector="#placeholder", where="beforeBegin", ui={ fluidRow(column(3, selectInput