Skip to contents

This function takes in trabecular, cortical, or finite element analysis bone microCT data at one site and compares it between two genotypes or two treatments using a Student's t-test.

Usage

compare_groups(data, type = NULL)

Arguments

data

Trabecular bone microCT data in a data frame, formatted as is the output of read_trabecular_csv(), read_cortical_csv(), or read_mfe_csv() (or read_*_excel()). Note that data for only one Site can be supplied at a time.

type

A string indicating the type of data supplied. Options include trabecular, cortical, or fea. Defaults to NULL, in which case the function will try to figure out which type of data it is.

Value

A list of each bone measure analyzed. Each measure is itself a list of each sex analyzed. Each sex is a tibble/data frame containing columns for Sex, Genotype (or Treatment), n, Mean, SEM, P, and Sig (a string containing "*" if P < 0.05, "**" if P < 0.01, or "***" if P < 0.001).

Details

If trabecular bone data are supplied, the measures compared include:

  • BV/TV

  • SMI

  • Tb.N

  • Tb.Th

  • Tb.Sp

If cortical bone data are supplied, the measures compared include:

  • Ct.vBMD

  • Ct.Th

  • End.Circ

  • Peri.Circ

  • Ct.Po

  • Ct.Po.V

If finite element analysis (fea) data are supplied, the measures compared include:

  • S

  • F.ult

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"),
                            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.
Spine.Tb <- gen_trab |> dplyr::filter(Site == "Spine") |>
                compare_groups()