yihui / formatR

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

modify format for array selecting #29

Closed wangyuchen closed 11 years ago

wangyuchen commented 11 years ago

when selecting in an array a[,1:5,1:10] tidy_block formats it into a[, 1:5, 1:10] but the first comma is always easy to be neglected (not beautiful as well) alternatively, if formatted into a[ , 1:5, 1:10] it clearly shows that the array has 3 dimensions and what's the conditions for each.

requesting a pull to get familiar with github too..

yihui commented 11 years ago

Thanks, but this is not very safe, e.g. what if an expression x <- "[,]"? You will modify it to x <- "[ ,]" but that really has changed the source code.

I believe a safe fix needs to be done in base R, which is unlikely to happen for R core, because this is more like a personal taste (e.g. I do not have problems with x[, 1, 2]).

wangyuchen commented 11 years ago

Thanks for your reply. I do neglect the possibility of that.

I was very interested in the fork/merge procedure on GitHub so I do this to try it. Next time, for such small modifications, is that more suitable to start an issue instead of fork and commit? So that everyone can see it and would't do that again.

在 2013-1-19,上午10:28,Yihui Xie notifications@github.com 写道:

Thanks, but this is not very safe, e.g. what if an expression x <- "[,]"? You will modify it to x <- "[ ,]" but that really has changed the source code.

I believe a safe fix needs to be done in base R, which is unlikely to happen for R core, because this is more like a personal taste (e.g. I do not have problems with x[, 1, 2]).

— Reply to this email directly or view it on GitHub.

yihui commented 11 years ago

Yes, if you want to contribute something, open an issue so I can decide if it is worth the efforts; then fork the repo and send me pull requests. You are welcome to contribute anyway.