Skip to contents

These are wrappers around readr::read_csv() and readxl::read_excel() to read in and process finite element analysis microCT data from a mfe.csv file or the MFE sheet of a data.xlsx file. It uses a key object to look up and add sex, genotype, and site information.

Usage

read_mfe_csv(file, key, ...)

read_mfe_excel(file, key, sheet = "MFE", ...)

Arguments

file

The file path to the mfe.csv or mfe.xlsx file.

key

The key object containing sample information, as created by the read_key_csv() or read_key_excel() function.

...

Additional arguments passed on to readr::read_csv() or readxl::read_excel().

sheet

For read_mfe_excel(), the sheet to read. Either a string (the name of a sheet), or an integer (the position of the sheet). Defaults to "MFE".

Value

A tibble/data frame containing finite element analysis data. For example:

|   AS|Sex |Genotype | SampNo|Site  | MeasNo|       S|  F.ult|
|----:|:---|:--------|------:|:-----|------:|-------:|------:|
| 1365|M   |Cre      |  10778|Spine |  31711| 11480.0| 32.257|
| 1365|M   |Cre      |  10778|Met   |  31710| 19034.1| 57.483|
| 1365|M   |Cre      |  10778|Dia   |  31712| 25405.7| 79.100|
| 1366|F   |Cre      |  10779|Spine |  31714| 12449.0| 34.213|
| 1366|F   |Cre      |  10779|Met   |  31713| 20679.9| 62.022|
| 1366|F   |Cre      |  10779|Dia   |  31715| 22832.0| 70.721|

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_mfe <- read_mfe_csv(mctr_ex("example-mfe.csv"),
                                gen_key)
#> Rows: 36 Columns: 47
#> ── Column specification ────────────────────────────────────────────────────────
#> Delimiter: ","
#> chr (12): SampName, MeasDate, ListDate, Filename, Site, Energy-I-Code, Contr...
#> dbl (30): 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_mfe <- read_mfe_excel(mctr_ex("example-genotype.xlsx"),
                                  gen_key)