Ace Code Editor in Shiny (shinyAce)

November 5, 2013
By

(This article was first published on Trestle Technology » R, and kindly contributed to R-bloggers)

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.

To leave a comment for the author, please follow the link and comment on his blog: Trestle Technology » R.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.