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
- Host: GitHub
- URL: https://github.com/Yang-Tang/shinyAceMod
- Owner: Yang-Tang
- Created: 2016-09-08T04:28:07.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-09-20T13:16:35.000Z (over 8 years ago)
- Last Synced: 2024-08-13T07:15:18.612Z (8 months ago)
- Language: R
- Homepage:
- Size: 389 KB
- Stars: 5
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.html
Awesome Lists containing this project
- jimsghstars - Yang-Tang/shinyAceMod - A shiny module of Ace editor for real-time debug (R)
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 averbatimTextOutput()
.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
- Source the module file
r source('shinyAceMod.R')
- 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
} ```
- Add Ace editor ui
```r 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.![]()
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);
})();