Expression input generally gets processed with formatR::tidy_source() due to the addition of this line in the .R source file:
knitr::opts_chunk$set(tidy = TRUE, tidy.opts = list(indent = 2))
But this does not play well with the bang-bang syntactic sugar from tidyeval:
formatR::tidy_source(
text = c(
"nameshift <- c(SL = 'Sepal.Length')",
"head(dplyr::rename(iris[,1:2], !!!nameshift), 3)"
)
)
#> nameshift <- c(SL = "Sepal.Length")
#> head(dplyr::rename(iris[, 1:2], !(!(!nameshift))), 3)
styler is under development and its non-invasive quality works to our advantage:
styler::style_text(
c(
"nameshift <- c(SL = 'Sepal.Length')",
"head(dplyr::rename(iris[,1:2], !!!nameshift), 3)"
)
)
#> [1] "nameshift <- c(SL = \"Sepal.Length\")"
#> [2] "head(dplyr::rename(iris[, 1:2], !!!nameshift), 3)"
Switch to that once it's on CRAN.
cc @krlmlr @lorenzwalthert
Expression input generally gets processed with
formatR::tidy_source()due to the addition of this line in the.Rsource file:But this does not play well with the bang-bang syntactic sugar from tidyeval:
styler is under development and its non-invasive quality works to our advantage:
Switch to that once it's on CRAN.
cc @krlmlr @lorenzwalthert