https://github.com/dgkf/callbackconnection
A connection target for R allowing arbitrary R code execution on stdout and stderr messages
https://github.com/dgkf/callbackconnection
Last synced: about 2 months ago
JSON representation
A connection target for R allowing arbitrary R code execution on stdout and stderr messages
- Host: GitHub
- URL: https://github.com/dgkf/callbackconnection
- Owner: dgkf
- Created: 2018-11-09T19:24:51.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-11-09T22:41:30.000Z (over 6 years ago)
- Last Synced: 2025-02-05T03:49:30.975Z (4 months ago)
- Language: C
- Homepage:
- Size: 6.84 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# callbackConnection
A new connection target for R allowing arbitrary R code execution on stdout and
stderr messages# Example [app.R](/examples/app.R)
Changing the input of the `selectInput()` prints, emits a message or an error.
```r
# relevant snippet
output$out <- renderText({
if (input$selection %in% "error something") {
stop(input$selection) # cause an error
} else if (input$selection %in% "message something") {
message(input$selection)
} else {
print(input$selection)
}input$selection
})
```
![]()
# Motivation
This was a proof of concept put together to alleviate my coworkers' difficulties
in accessing shiny app log files on a shared shiny server. I aimed to generalize
the problem to be able to handle arbitrary callbacks, though the primary goal
was to issue outputs to the JavaScript console in a browser using
`shinyjs::runjs()`.For more details, please take a look at the example [app.R](/examples/app.R).
# Known Issues
Within a shiny app, this callback is somewhat error prone and seems to cause
random crashes of the running app. It is by no means a polished product, and
hinges on some sloppy C code (my first attempt at writing C in about a
decade).