Appendix B
They should be meaningful and end in .R
_) to separate words within a nameBigCamelCase (link)If possible avoid using names of existing functions and variables
Use <- and not = for assignment
=, +, -, <-, etc.)= when calling a function:, :: and ::: do not need spacingExtra spacing is ok if it improves alignment of = or <-
If a function definition runs over multiple lines, indent the second line to where the definition starts
return(object)Often you can call a function without explicitly naming arguments:
plot(height, weight)mean(weight)This might be fine for plot() or mean
However for less common functions:
Comments
#and a single space-and=to break up code into easily readable chunksHomepage License Contact