Read in a sample definition key file
read_key_csv.RdThese are wrappers around readr::read_csv() and readxl::read_excel() to
read in and process a key.csv file or Key sheet of a data.xlsx file
that contains the lookup table defining each sample's AS (key registry)
number, sex, genotype (if applicable), treatment (if applicable), sample
number, and the measure number of each site scanned.
Arguments
- file
The file path to the
key.csvordata.xlsxfile.- sites
A character vector of the sites scanned, included as columns in the key file.
- ...
Additional arguments passed on to
readr::read_csv()orreadxl::read_excel().- sheet
For
read_key_excel(), the sheet to read. Either a string (the name of a sheet), or an integer (the position of the sheet). Defaults to"Key".
Value
A tibble/data frame containing the sample definitions. For example:
| AS|Sex |Genotype | SampNo|Site | MeasNo|
|----:|:---|:--------|------:|:-----|------:|
| 1365|M |Cre | 10778|Spine | 31711|
| 1365|M |Cre | 10778|Met | 31710|
| 1365|M |Cre | 10778|Dia | 31712|
| 1366|F |Cre | 10779|Spine | 31714|
| 1366|F |Cre | 10779|Met | 31713|
| 1366|F |Cre | 10779|Dia | 31715|Examples
gen_key <- read_key_csv(mctr_ex("example-gen-key.csv"))
#> Rows: 12 Columns: 7
#> ── Column specification ────────────────────────────────────────────────────────
#> Delimiter: ","
#> chr (2): Sex, Genotype
#> dbl (5): AS, SampNo, Spine, Met, Dia
#>
#> ℹ Use `spec()` to retrieve the full column specification for this data.
#> ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
gen_key <- read_key_excel(mctr_ex("example-genotype.xlsx"))