[ESS] indentation when chaining operators across lines
    Murat Tasan 
    mmuurr at gmail.com
       
    Thu Aug 13 17:56:25 CEST 2015
    
    
  
Does anyone know how I might be able to easily control indentation
when chaining R 'operators' across lines?
Here's an example with the default indentation applied:
1 +
    2 +
        3 +
            4
The preferred indentation would be something closer to:
1 +
    2 +
    3 +
    4 +
This seems like a trivial example, but here's one using dplyr's
chaining paradigm using the default indentation:
flights %>%
    group_by(year, month, day) %>%
        select(arr_delay, dep_delay) %>%
            summarise(
                arr = mean(arr_delay, na.rm = TRUE),
                dep = mean(dep_delay, na.rm = TRUE)
            ) %>%
                filter(arr > 30 | dep > 30)
And here's the same as found in dplyr's docs:
flights %>%
  group_by(year, month, day) %>%
  select(arr_delay, dep_delay) %>%
  summarise(
    arr = mean(arr_delay, na.rm = TRUE),
    dep = mean(dep_delay, na.rm = TRUE)
  ) %>%
  filter(arr > 30 | dep > 30)
The difficulty, I imagine, would be specifying the complete list of
valid operators which may 'continue' and EOL across the next line.
(My personal difficulty also happens to be my poor proficiency with elisp :-)
Any tips would be super-appreciated!
Cheers,
-Murat
    
    
More information about the ESS-help
mailing list