r - gvisTables not rendering in Shiny apps -
the actual issue i'm trying solve: i'm creating dashboard include data tables. numbers formatted commas thousands separators, there (apparently) issue dt package when it's used shiny, in comma-separated formatting causes dt::renderdatatable read in numbers character, affects how numbers sorted. (dt's number formatting functionality not work shiny, appears.)
where i'm @ far: solution i've been able find use googlevis instead of dt create tables. i'm running different issue (described below), care having data tables comma-separated numbers sort numbers.
the googlevis issue: when use gvistable outside of shiny apps, render fine, not render @ when using rendergvis , htmloutput in shiny. example, i'll borrow example 4 here.
not using shiny, code looks this:
library(datasets) library(googlevis) myoptions <- list(page='enable', pagesize=10, width=550) table <- gvistable(population,options=myoptions) plot(table)
using shiny, it's this:
library(datasets) library(googlevis) library(shiny) shinyapp( ui = pagewithsidebar( headerpanel("example 4: pageable table"), sidebarpanel( checkboxinput(inputid = "pageable", label = "pageable"), conditionalpanel("input.pageable==true", numericinput(inputid = "pagesize", label = "countries per page",10)) ), mainpanel( htmloutput("mytable") ) ), server = function(input,output){ myoptions <- reactive({ list( page=ifelse(input$pageable==true,'enable','disable'), pagesize=input$pagesize, width=550 ) }) output$mytable <- rendergvis({ gvistable(population,options=myoptions()) }) } )
any appreciated!
i solved own problem. turns out rstudio's native browser has difficulty displaying googlevis exhibits through shiny. needed open in firefox... don't think i've ever felt "woot" , "ugh" @ same time before.
Comments
Post a Comment