Using 'formatR' to reformat code is relatively easy. I wrote a function,
with the help of Walmes Zeviani, to do exactly that:

It can be bound to the indent function (C-M-\) with:

  (add-hook 'ess-mode-hook
            (lambda ()
              (load-library "ess-indent-region-r")
              (set (make-local-variable 'indent-region-function)

Now, if you want to use that style while coding, that would require a new
indentation style in ESS, which is essentially similar to the R engine
formating style. However, ESS indentation does not currently allow for all
of the perks of R style, notably with respect to call continuation and
indentation after the 5th level.

See this issue in ESS:

Let's say that following the R engine indentation style has been coldly


On 05/06/2017 05:10 PM, Stephen Eglen wrote:
> On Sat, May 06 2017, Stephen Eglen wrote:
>> since we are throwing ideas out there...  perhaps what the R universe
>> could do with is something similar to "gofmt" for the go language.  All
>> Go code looks the same, because there is a formatting tool, and everyone
>> uses it.  How about something similar for R...?!?
> Replying to myself again:
> does pretty much what gofmt does (I think).
> Stephen
> ______________________________________________
> mailing list


Mathieu Basille |
+1 954-577-6314 | University of Florida FLREC

  « Le tout est de tout dire, et je manque de mots
  Et je manque de temps, et je manque d'audace. »
  — Paul Éluard

This message is signed to guarantee its authenticity.
For a true private correspondence, use my public key
to encrypt your messages:

Learn more:

______________________________________________ mailing list

Reply via email to