knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "README-" )
formatEQ
correcting assignment styling in formatR
The objective of this package is to write a short patch to Yihui Xie's
formatR
package that inverts the
default behavior of the assignment operator replacement formatting rule so that
whenever <-
is present it is replaced with =
.
Presently, the package is only available on GitHub. It may eventually matriculate to CRAN if there is interest.
# install.packages("devtools") devtools::install_github("coatless/formatEQ")
To accomplish this, an override function trick
developed by Henrik Bengtsson is employed.
The trick allows for a very minimal change to occur to the
replacement_assignment()
function within formatR
. Thus,
there is no need to copy all of the package, but only the necessary components.
On package load, the function trick is then applied. Thus, if you were to
independently load formatR
, the content would remain exactly the same.
Unfortunately, this is more of a style guideline change and, thus, does not
warrant a patch. Furthermore, the API for the tidy_source
function is already
quite established and adding an option to seeminly invert the authors intended
functionality would likely yield numerous breakages. So, the safer course of
action is to provide a way for regenades of assignment to express themselves since:
No matter how hard you try, you can't stop us now
We're the renegades of this time and age
This is the time and age of renegades
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.