Style code according to the tidyverse style guide.
tidyverse_style(scope = "tokens", strict = TRUE, indent_by = 2, start_comments_with_one_space = FALSE, reindention = tidyverse_reindention(), math_token_spacing = tidyverse_math_token_spacing())
The extent of manipulation. Can range from "none" (least invasive) to "token" (most invasive). See 'Details'. This argument is a vector of length one.
A logical value indicating whether a set of strict
or not so strict transformer functions should be returned. Compare the
functions returned with or without
How many spaces of indention should be inserted after operators such as '('.
Whether or not comments should start
with only one space (see
A list of parameters for regex re-indention, most
conveniently constructed using
A list of parameters that define spacing around
math token, conveniently constructed using
The following options for
scope are available.
"none": Performs no transformation at all.
"spaces": Manipulates spacing between token on the same line.
"indention": In addition to "spaces", this option also manipulates the indention level.
"line_breaks": In addition to "indention", this option also manipulates line breaks.
"tokens": In addition to "line_breaks", this option also manipulates tokens.
As it becomes clear from this description, more invasive operations can only be performed if all less invasive operations are performed too.
style_text("call( 1)", style = tidyverse_style, scope = "spaces")#> call(1)style_text("call( 1)", transformers = tidyverse_style(strict = TRUE))#> call(1)style_text(c("ab <- 3", "a <-3"), strict = FALSE) # keeps alignment of "<-"#> ab <- 3 #> a <- 3style_text(c("ab <- 3", "a <-3"), strict = TRUE) # drops alignment of "<-"#> ab <- 3 #> a <- 3