Skip to content

Releases: yihui/formatR

formatR 1.14

17 Jan 22:58
Compare
Choose a tag to compare
  • tidy_source() supports the := operator now (which is widely used in data.table).

formatR 1.13

22 Dec 16:09
Compare
Choose a tag to compare
  • tidy_source() supports anonymous functions of the form \(args) expr for R >= 4.1.0 now (thanks, @notPlancha, #98).

formatR 1.12

31 Mar 20:19
Compare
Choose a tag to compare
  • Added a new argument pipe to tidy_source(). If pipe = 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).

formatR 1.11

01 Jun 18:55
Compare
Choose a tag to compare
  • The right arrow assignment operator -> is supported now.

  • Added a new argument args.newline to formatR::tidy_source(). When set to TRUE, function arguments can start on a new line, e.g.,

    shiny::updateSelectizeInput(session, "foo", label = "New Label", selected = c("A",
      "B"), choices = LETTERS, server = TRUE)

    can be reformatted to:

    shiny::updateSelectizeInput(
      session, "foo", label = "New Label", selected = c("A", "B"),
      choices = LETTERS, server = TRUE
    )

formatR 1.10

25 May 15:21
Compare
Choose a tag to compare
  • Support the new pipe operator |> in R 4.1.0.

  • The width.cutoff argument works more accurately when comments are indented (thanks, @iqis, #92). Previously, width.cutoff did 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 than width.cutoff.

formatR 1.9

14 Apr 15:33
Compare
Choose a tag to compare

NEW FEATURES

  • Lines will be wrapped after operators %>%, %T%, %$%, and %<>% now (thanks, @g4challenge #54, @jzelner #62, @edlee123 #68).

  • The argument width.cutoff of tidy_source() used to be the lower bound of line widths. Now if you pass a number wrapped in I(), 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.cutoff can be specified in the global option formatR.width now. By default, the value is still taken from the global option width like 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).

formatR 1.8

13 Mar 03:51
Compare
Choose a tag to compare
  • White spaces on blank lines are removed now (thanks, @nylander, #88).

  • This package requires R >= 3.2.3 now.

formatR 1.7

11 Jun 20:05
Compare
Choose a tag to compare

MAJOR CHANGES

  • tidy_source() will try to preserve the character encoding of the text argument in the output.

formatR 1.6

10 Mar 05:37
Compare
Choose a tag to compare

NEW FEATURES

  • Added a new argument wrap to tidy_source() so that users can choose not to wrap comments via tidy_source(..., wrap = FALSE), or set the global option options(formatR.wrap = FALSE) (thanks, @YongLiedu, #73).

CHANGES IN formatR VERSION 1.5

26 Apr 19:35
Compare
Choose a tag to compare

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 width means the maximum width (if possible) instead of the minimum; it also gained two new arguments, indent.by.FUN and fail; see ?formatR::usage for details