A shiny module of Ace editor for real-time debug
When debugging a shiny app, it would be very useful to check the value of an input or reactive object while the app is runing. By loading this shinyAce
-based shiny module, it's easy to perform this task in read-time. This shiny modlule provide an Ace editor interface that can evaluate user input code in shiny environment and displace output in a verbatimTextOutput()
.
This shiny module requires following packages. Please make sure they are installed.
# need dev version of shinyAce
devtools::install_github('trestletech/shinyAce')
install.package('pryr')
install.package('formatR')
- Source the module file
source('shinyAceMod.R')
- Invoke module in server function. Make sure to set an appropriate evaluation environment.
server <- function(input, output, session) {
callModule(shinyAceMod, id = 'YOU_MODULE_ID', eval_env = pryr::where('input'))
# other codes
}
- Add Ace editor ui
ui <- fluidPage(
shinyAceModUI('YOU_MODULE_ID')
)
- Run app and input code you want to run in the Ace editor. Press
Ctrl/CMD-Shift-Enter
to evaluate all input or pressCtrl/CMD-Enter
to evaluate current line or selected code.