Read in trabecular bone data
read_trabecular_csv.Rd
These are wrappers around readr::read_csv()
and readxl::read_excel()
to
read in and process trabecular bone microCT data from a trabecular.csv
file
or the Trabecular
sheet of a data.xlsx
file. It uses a key
object to
look up and add sex, genotype, and site information.
Usage
read_trabecular_csv(file, key, ...)
read_trabecular_excel(file, key, sheet = "Trabecular", ...)
Arguments
- file
The file path to the
trabecular.csv
ordata.xlsx
file.- key
The
key
object containing sample information, as created by theread_key_csv()
orread_key_excel()
function.- ...
Additional arguments passed on to
readr::read_csv()
orreadxl::read_excel()
.- sheet
For
read_trabecular_excel()
, the sheet to read. Either a string (the name of a sheet), or an integer (the position of the sheet). Defaults to"Trabecular"
.
Value
A tibble/data frame containing trabecular bone data. For example:
| AS|Sex |Genotype | SampNo|Site | MeasNo| BV/TV| SMI| Tb.N| Tb.Th| Tb.Sp|
|----:|:---|:--------|------:|:-----|------:|-----:|-----:|------:|-----:|-----:|
| 1365|M |Cre | 10778|Spine | 31711| 13.05| 1.631| 3.097| 0.051| 0.316|
| 1365|M |Cre | 10778|Met | 31710| 5.43| 3.227| 2.460| 0.062| 0.412|
| 1366|F |Cre | 10779|Spine | 31714| 21.88| 0.987| 14.227| 0.047| 0.111|
| 1366|F |Cre | 10779|Met | 31713| 4.47| 3.725| 2.666| 0.059| 0.371|
| 1367|F |Cre;fl | 10780|Spine | 31717| 14.47| 0.989| 2.551| 0.060| 0.398|
| 1367|F |Cre;fl | 10780|Met | 31716| 0.23| 4.172| 1.789| 0.034| 0.558|
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_trab <- read_trabecular_csv(mctr_ex("example-trabecular.csv"),
key = gen_key)
#> Rows: 24 Columns: 75
#> ── Column specification ────────────────────────────────────────────────────────
#> Delimiter: ","
#> chr (19): SampName, MeasDate, ListDate, Filename, Site, Energy-I-Code, Contr...
#> dbl (51): SampNo, MeasNo, Integr.Time, Sigma, Support, Threshold, Unit, Data...
#> lgl (5): S-DOB, S-Remark, Meas-Rmk, RAW-Label, IMA-Label
#>
#> ℹ 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_trab <- read_trabecular_excel(mctr_ex("example-genotype.xlsx"),
key = gen_key)