Shiny

Combining renderUI, dataTableOutput, and renderDataTable

孤者浪人 提交于 2021-02-11 14:17:23
问题 Suppose I have the following shiny app that renders a data table from the package DT: library(shiny) ui <- fluidPage(uiOutput("abc")) server <- function(input, output, session) { output$abc <- renderUI({DT::dataTableOutput("dt_output")}) # line 4 output$dt_output <- DT::renderDataTable({data.table(a = 1:3, b = 4:6)}) # line 5 } runApp(list(ui = ui, server = server)) How would you combine lines 4 and 5, with the constraint that output$abc must remain a uiOutput ? My attempt at combining (the

How to embed weather API into shinydashboards

允我心安 提交于 2021-02-11 14:06:52
问题 I am creating shiny dashboard that will have various information. One of the things that I am trying to implement is to have a section in the app for weather. I am learning shiny dashboard on the go. This in fact is my first shiny app. So in order to learn this I googled how to get weather into shiny dashboards. I came upon on a similar question here on stack overflow here and found out how a guy got boston weather into his app. I was able to mimic his code and in my shiny dashboard get the

R shiny - insertUI()'s “immediate” argument does not work with images

风格不统一 提交于 2021-02-11 14:06:46
问题 I am trying to update divs while in a loop, some of which contain images. Using removeUI(..., immediate = TRUE) I can remove them and then replace them by new divs, with insertUI(..., immediate = TRUE). Although the texts appear in real time, the images do not load until we are out of the loop (see example below, you don't even have to load an image, a question mark will appear after the loop ends). In my browser I can see the img tags are created in HTML, but still no images appear live.

Change font and color in helpText()

假如想象 提交于 2021-02-11 13:52:47
问题 How can I change the font and the color of helpText() in a shiny app? library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPagePlus( header = dashboardHeaderPlus( left_menu = tagList( helpText( a(target="_blank","Login",href="https://www.youtube.com/") ) ) ), sidebar = dashboardSidebar(), body = dashboardBody(), ), server = function(input, output) { } ) 回答1: You could modify the css class of the element. The css selector is .help-block a : ( .NAME is for

AddLegend Display Value range instead of percentage when using colorQuantile

一个人想着一个人 提交于 2021-02-11 13:31:07
问题 I am using R shiny-dashboard to display a weather raster file. I used colorQuantile as the method to display the color. In the legend, it shows the percentage. As you can see in the following image. I want the labels in the legend show the range of the value instead for each bin. I am not sure how to do that. Here is my server.R output$weather_map <- renderLeaflet({ rw = weatherband() if (!is.null(rw)) { pal_w = colorQuantile('RdYlGn', values(rw), na.color = 'transparent', n = 7) leaflet() %>

AddLegend Display Value range instead of percentage when using colorQuantile

倖福魔咒の 提交于 2021-02-11 13:31:01
问题 I am using R shiny-dashboard to display a weather raster file. I used colorQuantile as the method to display the color. In the legend, it shows the percentage. As you can see in the following image. I want the labels in the legend show the range of the value instead for each bin. I am not sure how to do that. Here is my server.R output$weather_map <- renderLeaflet({ rw = weatherband() if (!is.null(rw)) { pal_w = colorQuantile('RdYlGn', values(rw), na.color = 'transparent', n = 7) leaflet() %>

AddLegend Display Value range instead of percentage when using colorQuantile

蹲街弑〆低调 提交于 2021-02-11 13:30:28
问题 I am using R shiny-dashboard to display a weather raster file. I used colorQuantile as the method to display the color. In the legend, it shows the percentage. As you can see in the following image. I want the labels in the legend show the range of the value instead for each bin. I am not sure how to do that. Here is my server.R output$weather_map <- renderLeaflet({ rw = weatherband() if (!is.null(rw)) { pal_w = colorQuantile('RdYlGn', values(rw), na.color = 'transparent', n = 7) leaflet() %>

Achieve a database connection to rmd document via shiny app

冷暖自知 提交于 2021-02-11 12:54:17
问题 I have the shiny app below in which I pass database password via shiny app and then I want to connect it with rmd document in order to further process this con to produce plots. The issue is that I can get a succesfull connection outside of the shiny environment but when I try to do this via shiny and rmd I get: Error : nanodbc/nanodbc.cpp:1021: 01S00: [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user 'bpsrawdata'. [Microsoft][ODBC SQL Server Driver]Invalid connection

Delete DataTable rows in Shiny app using Javascript

血红的双手。 提交于 2021-02-11 12:47:32
问题 I'm trying to remove rows from a Datatable in a Shiny app using Javascript. In the table I have a column with a "delete" button for each row. This would be more or less what I'm trying to do, but I can't get it to work. In my server.R: initComplete <- DT::JS( "function () {", " var table = this.api();", " $('#delete_button').on('click', function() {", " table.row($(this).parents('tr')).remove().draw();", " });", "}" ) shinyInput <- function(FUN, len, id, ...) { inputs <- character(len) for (i

Delete DataTable rows in Shiny app using Javascript

一笑奈何 提交于 2021-02-11 12:47:31
问题 I'm trying to remove rows from a Datatable in a Shiny app using Javascript. In the table I have a column with a "delete" button for each row. This would be more or less what I'm trying to do, but I can't get it to work. In my server.R: initComplete <- DT::JS( "function () {", " var table = this.api();", " $('#delete_button').on('click', function() {", " table.row($(this).parents('tr')).remove().draw();", " });", "}" ) shinyInput <- function(FUN, len, id, ...) { inputs <- character(len) for (i