generated from r4ds/bookclub-template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
04_how-to-name-files.Rmd
52 lines (36 loc) · 1.45 KB
/
04_how-to-name-files.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# How to name files
See [Jenny Bryan's normconf talk](https://www.youtube.com/watch?v=ES1LTlnpLMk).
**Learning objectives:**
- Explain why it's useful to have a filename convention.
- Describe Jenny Bryan's naming convention.
## Why a convention? {-}
- Machine readable (easy to parse into meaning)
```{r 04-filenames, eval = FALSE}
# Better separate_ functions in dev version.
remotes::install_github("tidyverse/tidyr")
# Sample fiilename:
# 2014-02-26_BRAFWTNEGASSAY_FFPEDNA-CRC-1-41_A03.csv
# filenames is a vector of filenames like above
tibble(filenames) |>
tidyr::separate_wider_delim(
filenames,
delim = regex("[_\\.]"),
names = c("date", "assay", "line", "well", NA)
)
```
- Human readable (easy for you to understand what's there)
- Sorted in a useful way (dates or chapters ordered, etc)
## Jenny's convention {-}
> 2014-02-26_BRAFWTNEGASSAY_FFPEDNA-CRC-1-41_A03.csv
- Underscore `_` to delimit fields (date vs assay vs line vs well)
- Hyphen `-` to delimit words within fields (`2014-02-26`, `CRC-1-41`)
- "Has to be this way" because date convention
- Make things easy for Future You
- Don't over-abbreviate
- Start with something numberish for sorting when that makes sense
- Left pad numbers (01 vs 1)
- `stringr::str_pad(1:10, width = 2, pad = "0")`
- Dates ISO 8601: `YYYY-MM-DD`
## Meeting Videos {-}
### Cohort 1 {-}
`r knitr::include_url("https://www.youtube.com/embed/LkRGSBjUy_o")`