Closed vertesy closed 10 months ago
it's generally unsafe to do that since you could have
T <- 'hi there'
You would need advanced static code analysis tools to ensure you only convert a true TRUE
. That's out of scope for {styler}. But {lintr} offers checks for that so you can fix it manually.
Having said that, there are no generic transformers that replace arbitrary text and I would strongly advise against such replacements since they make styling unpredictable. Of course, you could write your own, there is documentation on that too.
It looks a bit complicated to me, so I wont implement it via styler
, but thank you for the explanation and warning. (Since the file is under git, I can see if something odd is replaced)
Solved in PackageTools
's replace_tf_with_true_false()
. Works completely safely with strict = TRUE
(default).
p0
>paste0
Thank you!