1

The usage function from removes white space unexpectedly. See the example below:

library(formatR)
library(tidyverse)
usage(
    FUN           = inner_join
  , width         = getOption("width")
  , tidy          = c(TRUE, FALSE)[1]
  , output        = c(TRUE, FALSE)[1]
  , indent.by.FUN = c(TRUE, FALSE)[2]
  , fail          = c("warn", "stop", "none")
)

inner_join(x, y, by = NULL, copy = FALSE, suffix = c(".x", ".y"), ..., keep = FALSE)

However, I want something like this:

inner_join(
  x,
  y,
  by = NULL,
  copy = FALSE,
  suffix = c(".x", ".y"),
  ...,
  keep = FALSE
)
M--
  • 25,431
  • 8
  • 61
  • 93
MYaseen208
  • 22,666
  • 37
  • 165
  • 309

1 Answers1

1

Trial and error with width will get you close to what you want:

usage(
  FUN           = inner_join
  , width         = 12
  , tidy          = TRUE
  , output        = TRUE
  , indent.by.FUN = TRUE
  , fail          = "none"
)

#> inner_join(
#>            x,
#>            y,
#>            by = NULL,
#>            copy = FALSE,
#>            suffix = c(".x", ".y"),
#>            ...,
#>            keep = FALSE)
M--
  • 25,431
  • 8
  • 61
  • 93
  • Thanks @M-- for useful answer. I want to use this output in Quarto document. Wondering if it possible to get colored output. – MYaseen208 Feb 25 '23 at 07:07
  • @MYaseen208 It's commented out because I used `reprex` package. You should be fine. – M-- Feb 25 '23 at 07:09