-
Notifications
You must be signed in to change notification settings - Fork 29
Celda Development Robust and Efficient Code
Zhe Wang edited this page May 24, 2019
·
7 revisions
See http://bioconductor.org/developers/how-to/efficient-code/
- Use
TRUEandFALSE. Do not useTorF. - Use
isTRUEandisFALSE. From the documentation of logical operators in R: "isTRUE(x)is the same as{is.logical(x) && length(x) == 1 && !is.na(x) && x}.isFALSE()is defined analogously. Consequently,if (isTRUE(cond))may be preferable toif (cond)because ofNAs." - Use
vapply(). Do not usesapply(). If possible, do not useunlist(lapply()). - Use
seq(5),seq_len(5), andseq_along(a). Do not use1:5or1:length(a). - Do not use
pastewithinmessage,stop, orwarningfunctions. These functions paste the texts for you. - Use
paste(rep("-", 50), collapse = ""). Do not use"--------------------------------------------------------------------".