You can re-format code with Control + Shift + A. This will add spaces after commas, brake lines to fit within 80 characters width, add spaces around equal signs, etc. You may dislike that formatting style butitiseasiertoread. Also see the styler package and the function goodpractice::gp().
Some specific comments:
Consider grouping functions in files by topic.
Avoid using tab to insert spaces. Instead use space.
Keep the widh of each line no longer than 80 characters. This improves readability. To achive this:
Set a guide line at 80 characters page width: Tools > Global Options > Code > Display > Show Margin > Margin Column = 80.
For comments (both normal comments and roxygen comments), master these two keyboard shortcuts:
Shift + Control + C to comment a line/paragraph.
Shift + Control + / to brake a paragraph into lines no longer than 80 characters.
I recommend this style guide http://style.tidyverse.org/ because it is well documented and current.
You can re-format code with Control + Shift + A. This will add spaces after commas, brake lines to fit within 80 characters width, add spaces around equal signs, etc. You may dislike that formatting style butitiseasiertoread. Also see the styler package and the function
goodpractice::gp()
.Some specific comments:
Keep the widh of each line no longer than 80 characters. This improves readability. To achive this:
Set a guide line at 80 characters page width: Tools > Global Options > Code > Display > Show Margin > Margin Column = 80.
For comments (both normal comments and roxygen comments), master these two keyboard shortcuts: