Shiny

How to Switch Between NavBar Tabs with a Button R Shiny

非 Y 不嫁゛ 提交于 2020-01-12 06:59:09
问题 I need the user to click a button and be taken to a different tabPanel of a navbarPage . Here is a simple app where this could be implemented. How can I achieve this? ui <- shinyUI( navbarPage('Test App', tabPanel('Page 1', p('This is the first tab'), br(), actionButton('jumpToP2', 'Jump to Second Tab') ), tabPanel('Page 2', p('This is the second tab'), actionButton('jumpToP1', 'Jump to First Tab') ) ) ) server <- shinyServer(function(input, output){ observeEvent(input$jumpToP2,{ ## Switch

Dynamically create sortable menuSubItems in shinydashboard

为君一笑 提交于 2020-01-12 05:49:07
问题 I have a Shiny app using the shinydashboard package in which I'm dynamically creating menuSubItem s in the sidebarMenu of a dashboardSidebar . The creation of the subItems is triggered by an actionButton. I can create the menuSubItem s on the server side just fine, but I would like to also make them sortable using the sortable package and sortable_js function. I just can't seem to figure out where to place the sortable_js function to make this actually work, though. Here's my MRE: library

Reactive input from renderDataTable

人走茶凉 提交于 2020-01-12 04:50:06
问题 UPDATE (18-Dec-2015) The currest best apporach for this problem is here: Get Selected Row From DataTable in Shiny App ====================== I am trying to reactively re-display a dataset using a row selection provided by the user. As a toy example, ui.R library(shiny) shinyUI(pageWithSidebar( headerPanel('Examples of DataTables'), sidebarPanel( checkboxGroupInput('show_vars', 'Columns to show:', names(mtcars), selected = names(mtcars)) ), mainPanel( dataTableOutput("mytable") ) ) ) server.R

Rstudio shiny ggvis tooltip on mouse hover

馋奶兔 提交于 2020-01-11 19:43:37
问题 In the example below, I have an interactive shiny ggvis plot, but I added a long column that is a long string and for some reason, my hover pop-up shows wt and mpg but does not show long . Also, if the list of elements in the legend is too long, they are hidden at the bottom right corner of the plot. Is there any way to stack these in several columns in the legend? Any ideas? # ui.R library(ggvis) shinyUI(pageWithSidebar( div(), sidebarPanel( sliderInput("n", "Number of points", min = 1, max

Rstudio shiny ggvis tooltip on mouse hover

萝らか妹 提交于 2020-01-11 19:43:20
问题 In the example below, I have an interactive shiny ggvis plot, but I added a long column that is a long string and for some reason, my hover pop-up shows wt and mpg but does not show long . Also, if the list of elements in the legend is too long, they are hidden at the bottom right corner of the plot. Is there any way to stack these in several columns in the legend? Any ideas? # ui.R library(ggvis) shinyUI(pageWithSidebar( div(), sidebarPanel( sliderInput("n", "Number of points", min = 1, max

R Shiny: includeMarkdown cannot render htmlwidgets

妖精的绣舞 提交于 2020-01-11 13:11:49
问题 This rmd file render ok to html, but the output is empty in shiny. Same problem with other htmlwidets like chartJSRadar file.rmd: --- title: "test" output: html_document --- ```{r} rpivotTable::rpivotTable(data.frame(a = c(1:10) ) , rows = 'a' ) ``` the htmlwidget is missing in this shiny app ui <- shinyUI( fluidPage( includeMarkdown('file.rmd') ) ) server <- function(input, output) { } shinyApp(ui, server) This question is related to this one 回答1: Answering my own question. The code in

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

被刻印的时光 ゝ 提交于 2020-01-11 10:38:32
问题 I have a dateInput in my ui.R as follows: dateInput("asOfDateTime", label = "As Of", value = Sys.Date(), max = Sys.Date()) For 2015-05-15 , this gives the dateInput a default value of 2015-05-14 . However, when I run Sys.Date() in the console on 2015-05-15 , I get the correct value: 2015-05-15 . Why does Shiny give yesterday's date inside my app? 回答1: 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

R datatable buttons export with formated cells

大兔子大兔子 提交于 2020-01-11 10:32:25
问题 The extensions Buttons works great for shiny application, from library(DT) . However it export the data without formatting. Is there a way to export data with format (e.g. percentage, or currency)? Similar question left unsolved. Reproducible code library(DT) data.frame(a = c(1,2), b = c(2,3)) %>% datatable(extensions = 'Buttons', options = list( dom = 'Bfrtip', buttons = c('copy', 'csv', 'excel', 'pdf', 'print')) )%>% formatPercentage('a') %>% formatCurrency('b') 回答1: Instead of using the

Is it possible to use more than 2 colors in the color_tile function?

荒凉一梦 提交于 2020-01-11 10:22:16
问题 I have a dataframe column that I'm currently formatting using the formattable::color_tile function (below): color_tile( "red", "springgreen" ) My issue with this is that the values near the middle are an ugly brown color, and I'd ideally like it to be a red-amber-green gradient, but color_tile seems to only be able to take min.color and max.color parameters - is it possible to use a 3rd color with either this or similar formatting functions in R? 回答1: It doesn't look like the function is

Is it possible to use more than 2 colors in the color_tile function?

梦想与她 提交于 2020-01-11 10:21:49
问题 I have a dataframe column that I'm currently formatting using the formattable::color_tile function (below): color_tile( "red", "springgreen" ) My issue with this is that the values near the middle are an ugly brown color, and I'd ideally like it to be a red-amber-green gradient, but color_tile seems to only be able to take min.color and max.color parameters - is it possible to use a 3rd color with either this or similar formatting functions in R? 回答1: It doesn't look like the function is