You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In my opinion, R Code style is a bit inconsistent in hyperSpec. I used styler package with the "Tidyverse" rules for automatic code style corrections followed by manual corrections spotted out by RStudio code style diagnostic tools. NOTE. If these corrections are unacceptable in hyperSpec, the authors of the package should write an R code writing style guidelines and use the style consistently throughout the vignettes, examples and R script files. It would be better if (1) linting (i.e., code style checking) rules are created for automatic checking (e.g., see package lintr and (2) if styler rules are created for doing automatic corrections (e.g., the authors of mlr package implemented their own rules).
I'm very much in favor of overhauling hyperSpec with styler().
There is one point where I personally would like to differ from tidyverse style: I find a slightly more "spacy" style that has a space between function name and opening parenthesis easier to read, so: log (10) instead of log(10).
However, I'd like to hear your opinions on this:
log (10) (space after function name easier to read):
I have generally been very happy with the default settings in styler, at least I don't care strongly enough about some items to figure out how to do them differently! However, if you (CB) want to keep your extra spacing, that's not too hard if it is already present:
I found this at this blog. So I would propose styling with strict = FALSE and then perhaps a little clean up. I can do this by the end of the weekend if you like (I just returned from a trip and have a lot of things to address as a result!).
I would prefer not to deviate from the tidyverse style as:
I personally find additional spacing a bit annoying, e.g., log (10) or chondro [[]] look to me as two different "words". In my work, I usually use the Tidyverse style as much as possible and if there are some deviations from the style, it is a distraction, that does not allow working as efficiently as possible. But really it is a matter of habit.
RStudio linting tools automatically suggest fixing this kind of syntax (see the blue underline and the blue (i) icon):
NOTE: By default, the styler fixes log (10) into log(10), but does not fix spacing before squared brackets, e.g., chondro [[]]
@bryanhanson: it's not too difficult to define and use a custom transformer that gives the extra space (I put one together before starting the discussion to make sure ;-)).
@GegznaV: the same is true for linting with lintr (with custom configuration in a .lint file for the project)
The additional effort would thus be small.
However the poll found:
2x preference for not having spaces
1x slight preference for spaces
1x no strong preference
=> let's stick to tidyverse defaults
I'll style() the R/ directory in the next days and then close this issue. The vignettes are IMHO best style()d as part of the translation process to .Rmd.
Activity
cbeleites commentedon Jan 14, 2020
I'm very much in favor of overhauling hyperSpec with
styler().There is one point where I personally would like to differ from tidyverse style: I find a slightly more "spacy" style that has a space between function name and opening parenthesis easier to read, so:
log (10)instead oflog(10).However, I'd like to hear your opinions on this:
log (10)(space after function name easier to read):log(10)(no space) easier to read:tidyr:bryanhanson commentedon Jan 15, 2020
I have generally been very happy with the default settings in
styler, at least I don't care strongly enough about some items to figure out how to do them differently! However, if you (CB) want to keep your extra spacing, that's not too hard if it is already present:I found this at this blog. So I would propose styling with
strict = FALSEand then perhaps a little clean up. I can do this by the end of the weekend if you like (I just returned from a trip and have a lot of things to address as a result!).GegznaV commentedon Jan 15, 2020
I would prefer not to deviate from the tidyverse style as:
log (10)orchondro [[]]look to me as two different "words". In my work, I usually use the Tidyverse style as much as possible and if there are some deviations from the style, it is a distraction, that does not allow working as efficiently as possible. But really it is a matter of habit.NOTE: By default, the
stylerfixeslog (10)intolog(10), but does not fix spacing before squared brackets, e.g.,chondro [[]]cbeleites commentedon Jan 15, 2020
@bryanhanson: it's not too difficult to define and use a custom transformer that gives the extra space (I put one together before starting the discussion to make sure ;-)).
@GegznaV: the same is true for linting with lintr (with custom configuration in a
.lintfile for the project)The additional effort would thus be small.
However the poll found:
=> let's stick to tidyverse defaults
I'll
style()theR/directory in the next days and then close this issue. The vignettes are IMHO beststyle()d as part of the translation process to .Rmd.cbeleites commentedon Jun 22, 2020
I think we can close this since it is by now in CONTRIBUTING.md