Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Naming files

Naming files

Effective organisation of files through naming.

The original sources of these notes, which were developed by Jenny Bryan, can be found here: http://www2.stat.duke.edu/~rcs46/lectures_2015/01-markdown-git/slides/naming-slides/naming-slides.pdf

Avatar for Peter Kamerman

Peter Kamerman

February 10, 2021
Tweet

More Decks by Peter Kamerman

Other Decks in Research

Transcript

  1. File naming Peter Kamerman Based on notes by Jenny Bryan

    (@JennyBryan) [link to the original slides] Effective organisation of files through naming
  2. File naming Key principles • Machine readable • Human readable

    • Plays nicely with default file ordering
  3. Machine readable Making searching and extracting information easier • Regular

    expression and globbing friendly (avoid white space, punctuation, accented characters; stick to one letter case) WRONG: Bjørn’s Awesome Slides.pptx BETTER: bjorns-awesome-slides.pptx • Easy to compute on (deliberate use of delimiters to separate meta-data units) WRONG: file 1 bjorns awesome slides 2020/10/10.pptx BETTER: file-01_bjorns-awesome-slides_2020-10-10.pptx In this use case: Underscores “_” were used to delimit units of meta-data; Hyphens “-” were used to separate words/numbers within each meta-data unit
  4. Human readable Make it easy to know what is in

    a file • Embrace the “slug” (Human readable information on file content) WRONG: figure-01.png BETTER: figure-01_bill-length-vs-flipper-length.png The slug: bill-length-vs-flipper-length
  5. Plays nicely with default ordering Making finding files easier •

    Put something numeric first • Use ISO8601 date format (YYYY-MM-DD) • Pad numbers (e.g., 01, not 1)
  6. Plays nicely with default ordering Making finding files easier WRONG:

    analysis-script-10.R analysis-script-1.R analysis-script-2.R … analysis-script-9.R clean-data.csv clean-data-final.csv clean-data-final-v2.csv raw-data.xlsx BETTER: 01_analysis-script_descriptive-statistics.R 02_analysis-script_linear-regression.R … 10_analysis-script_figures-for-manuscript.R 2020-01-03-raw-data.xlsx 2020-01-04_clean-data.csv 2020-01-06a_clean-data.csv 2020-01-06b_clean-data.csv