Styles a character vector. Each element of the character vector corresponds to one line of code.
style_text(text, ..., style = tidyverse_style, transformers = style(...))
text | A character vector with text to style. |
---|---|
... | Arguments passed on to the |
style | A function that creates a style guide to use, by default
|
transformers | A set of transformer functions. This argument is most
conveniently constructed via the |
Other stylers: style_dir
,
style_file
, style_pkg
style_text("call( 1)")#> [1] "call(1)"style_text("1 + 1", strict = FALSE)#> [1] "1 + 1"style_text("a%>%b", scope = "spaces")#> [1] "a %>% b"style_text("a%>%b; a", scope = "line_breaks")#> [1] "a %>%" " b; a"style_text("a%>%b; a", scope = "tokens")#> [1] "a %>%" " b()" "a"# the following is identical but the former is more convenient: style_text("a<-3++1", style = tidyverse_style, strict = TRUE)#> [1] "a <- 3 + +1"#> [1] "a <- 3 + +1"