View source: R/pipe_continuation_linter.R
pipe_continuation_linter | R Documentation |
Check that each step in a pipeline is on a new line, or the entire pipe fits on one line.
pipe_continuation_linter()
default, readability, style
linters for a complete list of linters available in lintr.
# will produce lints
code_lines <- "1:3 %>%\n mean() %>% as.character()"
writeLines(code_lines)
lint(
text = code_lines,
linters = pipe_continuation_linter()
)
code_lines <- "1:3 |> mean() |>\n as.character()"
writeLines(code_lines)
lint(
text = code_lines,
linters = pipe_continuation_linter()
)
# okay
lint(
text = "1:3 %>% mean() %>% as.character()",
linters = pipe_continuation_linter()
)
code_lines <- "1:3 %>%\n mean() %>%\n as.character()"
writeLines(code_lines)
lint(
text = code_lines,
linters = pipe_continuation_linter()
)
lint(
text = "1:3 |> mean() |> as.character()",
linters = pipe_continuation_linter()
)
code_lines <- "1:3 |>\n mean() |>\n as.character()"
writeLines(code_lines)
lint(
text = code_lines,
linters = pipe_continuation_linter()
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.