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
*Exception: When creating a classed object, the function name (constructor) and class should match (e.g., lm).*
38
39
- kConstantName
39
40
@@ -46,11 +47,13 @@ The maximum line length is 80 characters.
46
47
### Indentation
47
48
48
49
When indenting your code, use two spaces. Never use tabs or mix tabs and spaces.
50
+
49
51
*Exception: When a line break occurs inside parentheses, align the wrapped line with the first character inside the parenthesis.*
50
52
51
53
### Spacing
52
54
53
55
Place spaces around all binary operators (=, +, -, <-, etc.).
56
+
54
57
*Exception: Spaces around ='s are optional when passing parameters in a function call.*
55
58
56
59
Do not place a space before a comma, but always place one after a comma.
@@ -90,6 +93,7 @@ plot (x = x.coord,
90
93
main = (paste(metric, " for 3 samples ", sep = "")))
91
94
```
92
95
Do not place spaces around code in parentheses or square brackets.
96
+
93
97
*Exception: Always place a space after a comma.*
94
98
95
99
**GOOD:**
@@ -105,6 +109,7 @@ x[1,] # Needs a space after the comma
105
109
### Curly Braces
106
110
107
111
An opening curly brace should never go on its own line; a closing curly brace should always go on its own line. You may omit curly braces when a block consists of a single statement; however, you must consistently either use or not use curly braces for single statement blocks.
112
+
108
113
**GOOD:**
109
114
```
110
115
if (is.null(ylim)) {
@@ -125,6 +130,7 @@ if (is.null(ylim)) {ylim <- c(0, 0.06)}
125
130
Surround "else" with braces.
126
131
127
132
An "else" statement should always be surrounded on the same line by curly braces.
133
+
128
134
**GOOD:**
129
135
```
130
136
if (condition) {
@@ -197,6 +203,7 @@ hist(df$pct.spent,
197
203
Function definitions should first list arguments without default values, followed by those with default values.
198
204
199
205
In both function definitions and function calls, multiple arguments per line are allowed; line breaks are only allowed between assignments.
0 commit comments