File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -154,6 +154,14 @@ can use RStudio's full text search to find where
154
154
* only very low-level functions or functions that don't fit in any other file
155
155
go to ` utils.R ` .
156
156
157
+ ### Control Flow
158
+
159
+ * Conditional statements should always evaluate to ` TRUE ` or ` FALSE ` , i.e. we
160
+ don't encourage ` if (length(x)) ` but rather ` if (length(x) > 0L) ` .
161
+ * We avoid loops whenever possible and use functions like ` purrr::map() ` and
162
+ friends when possible and prefer them over R base counterparts like
163
+ ` base::lapply() ` .
164
+
157
165
### Boolean Values
158
166
159
167
Functions that return Boolean values or variables that hold Boolean values are
@@ -165,3 +173,8 @@ otherwise.
165
173
166
174
Vectors that hold indices are often suffixed with ` idx ` . ` else_idx ` for example
167
175
indicates for every row in a parse table whether it contains an ` else ` token.
176
+
177
+ ### Closures
178
+
179
+ The use of closures is discouraged. We prefer to prefill a template function
180
+ with ` purrr::partial() ` .
You can’t perform that action at this time.
0 commit comments