Skip to content

Same formatting rules afforded by formatR with the exception that `<-` is transformed to `=`.

Notifications You must be signed in to change notification settings

coatless/formatEQ

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 =.

Download Instructions

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")

How was this accomplished?

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.

Why not submit a patch?

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

--- Rage Against the Machine - Renegades of Funk

About

Same formatting rules afforded by formatR with the exception that `<-` is transformed to `=`.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages