Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
The Ace code editor is an elegant, full-featured, browser-based code editor used in such products as RStudio’s IDE. We’re announcing a new R package called shinyAce (now available on CRAN) which integrates the Ace editor into the Shiny web framework.
For those who may be unfamiliar, Shiny is an R package which makes it trivial to create interactive web applications in R — even without knowing any of the languages typically used to create websites (like HTML or JavaScript).
shinyAce exposes all of the color schemes and programming languages (called “modes” in Ace) that Ace supports, meaning you can customize the look and feel of the editor and support syntax highlighting for R, JavaScript, Python, and dozens of other languages. The editor is treated as just another input in Shiny, making it simple to reactively access the text currently contained in the editor. There is also an update
function that allows you to update the text (or mode/theme) once the editor has already been created.
See the GitHub page to download the code, view installation instructions, or see details on the examples that come with the package. These examples showe how to create Shiny applications that use shinyAce to allow users to edit and run R code, R Markdown, or even another Shiny user interface.
To install the package:
# Download and install shinyAce install.packages('shinyAce')
To run an example of shinyAce that features all the available modes and themes on your own machine now:
# Install and load Shiny and ShinyAce install.packages('shinyAce') library(shiny) runApp(system.file("examples/01-basic", package="shinyAce"))
You can view a description of all the examples (and instructions for running them) on the GitHub page. Feel free to let us know if you have any issues or feature requests on our Issues page.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.