Recent Releases of formatR
formatR - formatR 1.14
tidy_source()supports the:=operator now (which is widely used in data.table).
- R
Published by yihui over 3 years ago
formatR - formatR 1.13
tidy_source()supports anonymous functions of the form\(args) exprfor R >= 4.1.0 now (thanks, @notPlancha, #98).
- R
Published by yihui over 3 years ago
formatR - formatR 1.12
Added a new argument
pipetotidy_source(). Ifpipe = TRUE, it will convert the magrittr pipe%>%to the base R pipe operator|>.Added a function
tidy_rstudio()to reformat R code in the RStudio editor.Added a function
tidy_pipe()to substitute%>%with|>(currently works only in RStudio).
- R
Published by yihui over 4 years ago
formatR - formatR 1.11
The right arrow assignment operator
->is supported now.Added a new argument
args.newlinetoformatR::tidy_source(). When set toTRUE, function arguments can start on a new line, e.g.,
r
shiny::updateSelectizeInput(session, "foo", label = "New Label", selected = c("A",
"B"), choices = LETTERS, server = TRUE)
can be reformatted to:
r
shiny::updateSelectizeInput(
session, "foo", label = "New Label", selected = c("A", "B"),
choices = LETTERS, server = TRUE
)
- R
Published by yihui about 5 years ago
formatR - formatR 1.10
Support the new pipe operator
|>in R 4.1.0.The
width.cutoffargument works more accurately when comments are indented (thanks, @iqis, #92). Previously,width.cutoffdid not take the indentation or the number of#characters in a comment when wrapping it, which may lead to wrapped comment lines that are wider thanwidth.cutoff.
- R
Published by yihui about 5 years ago
formatR - formatR 1.9
NEW FEATURES
Lines will be wrapped after operators
%>%,%T%,%$%, and%<>%now (thanks, @g4challenge #54, @jzelner #62, @edlee123 #68).The argument
width.cutoffoftidy_source()used to be the lower bound of line widths. Now if you pass a number wrapped inI(), it will be treated as the uppper bound, e.g.,tidy_source(width.cutoff = I(60)). However, please note that the upper bound cannot always be respected, e.g., when the code contains an extremely long string, there is no way to break it into shorter lines automatically (thanks, @krivit @pablo14, #71).The value of the argument
width.cutoffcan be specified in the global optionformatR.widthnow. By default, the value is still taken from the global optionwidthlike before.
BUG FIXES
- When the text in the clipboard on macOS does not have a final EOL,
tidy_source()fails to read the last line (thanks, @edlee123, #54).
- R
Published by yihui over 5 years ago
formatR - formatR 1.8
White spaces on blank lines are removed now (thanks, @nylander, #88).
This package requires R >= 3.2.3 now.
- R
Published by yihui over 5 years ago
formatR - formatR 1.7
MAJOR CHANGES
tidy_source()will try to preserve the character encoding of thetextargument in the output.
- R
Published by yihui about 7 years ago
formatR - formatR 1.6
NEW FEATURES
- Added a new argument
wraptotidy_source()so that users can choose not to wrap comments viatidy_source(..., wrap = FALSE), or set the global optionoptions(formatR.wrap = FALSE)(thanks, @YongLiedu, #73).
- R
Published by yihui over 7 years ago
formatR - CHANGES IN formatR VERSION 1.5
NEW FEATURES
added a new function
tidy_file()to format specified R scripts (thanks, @edlee123, #61)usage() was re-implemented by @egnha in #66; the major difference with the previous version is that
widthmeans the maximum width (if possible) instead of the minimum; it also gained two new arguments,indent.by.FUNandfail; see?formatR::usagefor details
- R
Published by yihui about 9 years ago
formatR - CHANGES IN formatR VERSION 1.4
NEW FEATURES
tidy_source()can preserve line breaks in character strings in source code
MAJOR CHANGES
- the deprecated functions
tidy.source(),tidy.dir(), andtidy.eval()have been removed; usetidy_source(),tidy_dir()andtidy_eval()instead - comments that begin with
#+or#-are no longer wrapped; such comments are treated as knitr chunk options inknitr::spin()(#52)
BUG FIXES
tidy_source()should not write an extra space to the last line of code (thanks, @mr-karan, #49)- long strings (> 1000 characters) in source code can be preserved now (thanks, @jholtman, #50)
tidy_source()might move any lines of code starting withelseback to the previous lines (thanks, @Auburngrads, #51)
- R
Published by yihui about 10 years ago
formatR - CHANGES IN formatR VERSION 1.1
NEW FEATURES
- added a new argument
outputtousage()
BUG FIXES
- fixed yihui/knitr#918: when code is NULL,
parse()will hang (with a question mark waiting for input)
- R
Published by yihui over 10 years ago
formatR - CHANGES IN formatR VERSION 1.2
- the minimal required R version is 3.0.2 now
- R
Published by yihui over 10 years ago
formatR - CHANGES IN formatR VERSION 1.3
NEW FEATURES
tidy_source()can deal with multibyte characters that cannot represented in the system native encoding now (on Windows)usage()works for functions obtained from::or:::now, e.g.usage(formatR::tidy_source)
- R
Published by yihui over 10 years ago