yihui / formatR

Format R Code Automatically
https://yihui.org/formatr/
255 stars 52 forks source link

move 'else ' back one line #9

Closed yihui closed 13 years ago

yihui commented 13 years ago

else should not start with a new line; this happens for deparse() when the if-else statement is inside a function

> formatR::tidy.source(text='function(){if(T){1+1} else 2}')
function() {
    if (T) {
        1 + 1
    }
    else 2
} 

in unmask.source(), find the line ^[[:space:]]*else and move it back for one line