Skip to content

Latest commit

 

History

History
40 lines (28 loc) · 1.07 KB

our_style.md

File metadata and controls

40 lines (28 loc) · 1.07 KB

Code

Code lives in the code directory in files named according to the chapter they are in, e.g. 01-venn.R. The code does not have to be self-standing: it can depend on code run previously in the chapter.

  • library(package) - library without quotes
  • = - assignment operator (open for debate)
  • = , >, etc. - spaces around operators
  • "text" - double quotes for character values
  • for(i in 1:9) {print(i)} - use space separation for curly brackets
  • When indenting your code, use two spaces

Comments

Comment your code unless obvious because the aim is teaching. Use capital first letter for full-line comment.

# Create object x
x = 1:9

Do not capitalise comment for end-of-line comment

y = x^2 # square of x

Text

Use one line per sentence during development for ease of tracking changes. Leave a single empty line space before and after each code chunk.

package_name class_of_object function_name()

Figures

Names of the figures should contain a chapter number, e.g. 04-world_map.png or 11-population_animation.gif.