|
15 | 15 | File names should end in .R, delimeter '\_', lowercase notation and, of course, be meaningful.
|
16 | 16 |
|
17 | 17 | **GOOD:** predict\_ad\_revenue.R
|
18 | | -**BAD:** foo.R |
| 18 | + |
| 19 | +**BAD:** foo.R |
19 | 20 |
|
20 | 21 | ### Identifiers
|
21 | 22 |
|
22 | 23 | Don't use underscores ( _ ) or hyphens ( - ) in identifiers. Identifiers should be named according to the following conventions. Variable names have initial lower case letters. If variable name consists of several words, then they aren't separated, but all words except for the first one begin with capital letters. Function names are formed like variable names but with initial capital letter (FunctionName); constants are named like functions but with an initial k.
|
23 | 24 | - variableName
|
24 | | -** GOOD:** avgClicks |
25 | | -**BAD:** avg_Clicks |
| 25 | + |
| 26 | + **GOOD:** avgClicks |
| 27 | + |
| 28 | + **BAD:** avg_Clicks |
| 29 | + |
26 | 30 | - FunctionName
|
27 | | -** GOOD:** CalculateAvgClicks |
28 | | -** BAD:** calculate_avg_clicks , calculateAvgClicks |
| 31 | + |
| 32 | + **GOOD:** CalculateAvgClicks |
| 33 | + |
| 34 | + **BAD:** calculate_avg_clicks , calculateAvgClicks |
| 35 | + |
29 | 36 | Make function names verbs.
|
30 | 37 | *Exception: When creating a classed object, the function name (constructor) and class should match (e.g., lm).*
|
31 | 38 | - kConstantName
|
|
0 commit comments