⚠️There's a newer version (1.10.3) of this package.Take me there.
styler
The goal of styler is to provide non-invasive pretty-printing of R
source code while adhering to the
tidyverse formatting rules. styler can be
customized to format code according to other style guides too.
This was just the tip of the iceberg. Learn more about customization
with the tidyverse style guide in in this
vignette. If
this is not flexible enough for you, you can implement your own style
guide, as explained in the corresponding
vignette.
Adaption of styler
styler functionality is made available through other packages, most
notably
usethis::use_tidy_style() styles your project according to the
tidyverse style guide.
reprex::reprex(style = TRUE) to prettify reprex code before
printing. To permanently use style = TRUE without specifying it
every time, you can add the following line to your .Rprofile (via
usethis::edit_r_profile()): options(reprex.styler = TRUE).
you can pretty-print your R code in RMarkdown reports without having
styler modifying the source. This feature is implemented as a code
chunk option in knitr. use tidy = "styler" in the header of a code
chunks (e.g. ```{r name-of-the-chunk, tidy = "styler"}), or
knitr::opts_chunk$set(tidy = "styler") at the top of your
RMarkdown script.
pretty-printing of drake
workflow data frames with drake::drake_plan_source().
Adding styler as a fixer to the ale
Plug-in
for VIM.
Further resources
The official web documentation of
styler, containing various vignettes function documentation as well
as a change-log.
Blog
post
about how you can customize styler without being an expert.
The wiki of Google Summer of Code
2017
or the pkgdown page contain
information related to the initial development phase during Google
Summer of Code 2017.