View source: R/unnecessary_placeholder_linter.R
unnecessary_placeholder_linter | R Documentation |
The argument placeholder .
in magrittr pipelines is unnecessary if
passed as the first positional argument; using it can cause confusion
and impacts readability.
unnecessary_placeholder_linter()
This is true for forward (%>%
), assignment (%<>%
), and tee (%T>%
) operators.
best_practices, readability
linters for a complete list of linters available in lintr.
# will produce lints
lint(
text = "x %>% sum(., na.rm = TRUE)",
linters = unnecessary_placeholder_linter()
)
# okay
lint(
text = "x %>% sum(na.rm = TRUE)",
linters = unnecessary_placeholder_linter()
)
lint(
text = "x %>% lm(data = ., y ~ z)",
linters = unnecessary_placeholder_linter()
)
lint(
text = "x %>% outer(., .)",
linters = unnecessary_placeholder_linter()
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.