r - Shiny - Call panel from external code -
i have been working on shiny application ui.r script has become long , becoming hard manage. break code different sections, , call them within ui. guess helpful different panels become nested , complicated.
is there way this?
example ui.r script:
shinyui(pagewithsidebar( headerpanel('iris k-means clustering'), sidebarpanel( selectinput('xcol', 'x variable', names(iris)), selectinput('ycol', 'y variable', names(iris), selected=names(iris)[[2]]), numericinput('clusters', 'cluster count', 3, min = 1, max = 9) ), mainpanel( plotoutput('plot1') ) )) it nice if change following (i have written in pseudo code):
shinyui(pagewithsidebar( headerpanel('iris k-means clustering'), source("call_sidebarpanel.r"), mainpanel( plotoutput('plot1') ) )) call_sidebarpanel.r
sidebarpanel( selectinput('xcol', 'x variable', names(iris)), selectinput('ycol', 'y variable', names(iris), selected=names(iris)[[2]]), numericinput('clusters', 'cluster count', 3, min = 1, max = 9) )
yes possible, in non-trivial apps. trick use
source("file.r", local = true)$value this shiny article has information on this.
Comments
Post a Comment