styler

Build Status AppVeyor Build Status stability-stable codecov cran version

The goal of styler is to provide non-invasive pretty-printing of R source code while adhering to the tidyverse formatting rules. Support for custom style guides is planned.

You can install the package from CRAN:

install.packages("styler")

Or get the development version from GitHub:

# install.packages("remotes")
remotes::install_github("r-lib/styler")

You can style a simple character vector of code with style_text():

ugly_code <- "a<-function( x){1+1}           "
style_text(ugly_code)
#> a <- function(x) {
#>   1 + 1
#> }

There are a few variants of style_text():

You can find more information on the wiki of Google Summer of Code 2017 or check out the pkgdown page.