[ESS] Indenting of R code, particularly dplyr code.

Vitalie Spinu @p|nuv|t @end|ng |rom gm@||@com
Wed Oct 7 20:27:43 CEST 2015


ESS moved from 2 to 4 spaces some years back. Indentation was completely
rewritten in 15.09 and you probably should be just fine by setting default
styles. They all were carefully designed.

So, with 15.09 either

 (setq ess-default-style 'RStudio)

or

 (setq ess-indent-offset 2)

or play with more refined customization variables as Lionel suggested and as
described in `ess-style-alist`.

In all cases you will get straight indentation:
  
  neofabLast.df %>%
    arrange(tree, treatment) %>%
    group_by(treatment, tree) %>%
    summarise(No = mean(no), Diam = mean(diam))

For the cascading style set ess-offset-continued to 'cascade.


  Vitalie


>> On Wed, Oct 07 2015 11:50, Lionel Henry wrote:

>> On 7 oct. 2015, at 11:09, Patrick Connolly <p_connolly using slingshot.co.nz> wrote:
>> 
>> |> I guess you really should update your ESS version. The
>> |> indentation code got completely rewritten in the last version.
>> 
>> If I can't customize it to indent only two characters, I'll keep my
>> ancient version.  4 characters is too much indentation.

> If your global offset level is 4 and you want continuations to be
> indented with 2 spaces, you customise it like this :

> (setq ess-offset-continued '(straight 2))

> Lionel
> ______________________________________________
> ESS-help using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help




More information about the ESS-help mailing list