An open API service indexing awesome lists of open source software.

https://github.com/Yang-Tang/shinyAceMod

A shiny module of Ace editor for real-time debug
https://github.com/Yang-Tang/shinyAceMod

Last synced: 4 months ago
JSON representation

A shiny module of Ace editor for real-time debug

Awesome Lists containing this project

README

        

code{white-space: pre;}

pre:not([class]) {
background-color: white;
}

if (window.hljs && document.readyState && document.readyState === "complete") {
window.setTimeout(function() {
hljs.initHighlighting();
}, 0);
}

h1 {
font-size: 34px;
}
h1.title {
font-size: 38px;
}
h2 {
font-size: 30px;
}
h3 {
font-size: 24px;
}
h4 {
font-size: 18px;
}
h5 {
font-size: 16px;
}
h6 {
font-size: 12px;
}
.table th:not([align]) {
text-align: left;
}

.main-container {
max-width: 940px;
margin-left: auto;
margin-right: auto;
}
code {
color: inherit;
background-color: rgba(0, 0, 0, 0.04);
}
img {
max-width:100%;
height: auto;
}
.tabbed-pane {
padding-top: 12px;
}
button.code-folding-btn:focus {
outline: none;
}

$(document).ready(function () {
window.buildTabsets("TOC");
});


shinyAceMod


A shiny module of Ace editor for real-time debug



Introduction


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 and evaluate any code input in shiny environment and displace output in a verbatimTextOutput().




Pre-request


This shiny module requires following packages. Please make sure they are installed.


devtools::install_github('trestletech/shinyAce')

install.package('pryr')
install.package('formatR')



Usage



  1. Source the module file


r source('shinyAceMod.R')



  1. Invoke module in server function. Make sure to set an appropriate evaluation environment.


```r server <- function(input, output, session) {


callModule(shinyAceMod, id = 'YOU_MODULE_ID', eval_env = pryr::where('input'))

# other codes


} ```



  1. Add Ace editor ui


```r ui <- fluidPage(


shinyAceModUI('YOU_MODULE_ID')

) ```



  1. Run app and input code you want to run in the Ace editor. Press Ctrl/CMD-Shift-Enter to evaluate all input or press Ctrl/CMD-Enter to evaluate current line or selected code.



alt text

alt text




// add bootstrap table styles to pandoc tables
$(document).ready(function () {
$('tr.header').parent('thead').parent('table').addClass('table table-condensed');
});

(function () {
var script = document.createElement("script");
script.type = "text/javascript";
script.src = "https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML";
document.getElementsByTagName("head")[0].appendChild(script);
})();