Skip to content

Style Guide

Rochelle Terman edited this page Oct 6, 2020 · 1 revision

Naming Repos and Files

Repo directories:

  • Each lesson repo should be called: XX-Title, as in: 08-Plots
  • Each lesson repo should contain an .Rproj file called: XX-Title.Rproj, as in 08-Plots.Rproj

Repo files:

  • Individual sub-lessons should be called XX_N-Subtitle.Rmd, as in 08_1-Base.Rmd, 08_2-ggplot.Rmd.
  • Sub-lesson numbers start at 1, even if there is only one sub-lesson, and contain a single digit.
  • Subtitles are capitalized unless its the name of a package. Subtitles should ideally be one word, or separated using: XX_N-Longer_Subtitle.Rmd
  • All solution files should be have N = 99, as in 08_99-Solutions.Rmd.

Assignments:

  • Assignments are called AX-Title, as in A3-Plots.

General Formatting

  • Every library that we need to load should be included in the first code chunk of the file. Do not load any library that you do not need.
  • Each element in a list starts with a capitalized letter (unless it is the name of a package/object) and ends with a period.
  • Abbreviations are avoided.
  • Words like "GitHub," "Git," and "Canvas" are always capitalized.
  • A comma should be used after i.e. and e.g.
  • No colons at the end of chapter or sub-chapter titles.
  • Period after "Challenge #" in headers 4.
  • Headers 4 that contain verbs are capitalized as any sentence and end with a period.
  • Acknowledgments should be only at the end of every repository.
  • Hide code chunks that display images.
  • If the sentence before an R code chunk refers to the code chunk (like "this is what you have to do," followed by the code chunk), use a colon.
  • For notes, always use NB.
  • For quotes, use > and no quote marks. Separate the quote from its author in two different lines. Do not use a dash before the author's name. Make the author's name bold.
  • Numbers below 10 are written in words (e.g., zero, one, and two) unless they indicate a certain column/row/variable/etc. (e.g., column 1, variable 2).
  • General formatting applies to comments inside code chunks too.

General R Markdown Formatting

  • __x__, **x** : Bold.
  • _x_, *x* : Italic.
  • --- : Dash.
  • > : Used in block quotes.
  • ^[x] : Inserts footnote.
  • [x](x.com) : Inserts link.

Headers

  • #: New Chapter (ch 1).
  • ##: Sub-chapter (1.1).
  • ###: Sub-sub-chapter (1.1.1).
  • ####.... {-}: Headers 4 and above will not appear in table of contents. The {-} will prevent automatic numbering.

Lists

  • *, - : Bullet points.
  • 1., 2., 3., etc. or 1), 2), 3), etc.: Numbered list.

Clone this wiki locally