Best practices for readable, sharable, and verifiable R code
.R
_
not .
.
is also accepted.
with class names due to potential confusion with S3 method declarations
_
or -
with identifiers<-
not =
;
=, +, -, <-,
etc.(
, except in a function call{
on its own line }
on its own line unless followed by else
else
statements with curly braces #
followed by a space#
seq(along = x)
to protect against instances where x
is emptyapply, lapply, etc
when possible
repeat
for better interpretability