Repository navigation
Releases
klct v0.2.2
- Y-axis labels with units:
plot_groups()facet strips and
plot_groups_2x2()y-axis labels now display the measure name with its
unit (e.g., "Ct.Th (mm)", "Ct.vBMD (mg HA/cm³)"). Inplot_groups(),
the unit wraps to a second line below the measure name so that facet strips
stay compact even with long units. An internalmeasure_unitslookup in
R/labels.Rmaps every NeoScan measure column to its unit string; unknown
measures fall back to the raw column name.
klct v0.2.1
Plot improvements
-
Significance brackets:
plot_groups()now uses
ggsignif::geom_signif()to draw proper comparison brackets between the
two treatment groups, replacing the previousgeom_text()approach that
placed asterisks above individual group bars. Brackets appear only in
facets with a significant result (P < 0.05). Pre-computed p-values
(Welch's t-test or Wilcoxon) are passed through, keeping the test logic
consistent withcompare_groups(). -
Data-driven y-axis limits: Removed
expand_limits(y = 0)from both
plot_groups()andplot_groups_2x2(). Axis limits are now determined
automatically by ggplot based on the data range, which substantially
improves readability for measures whose values are far from zero (e.g.,
Ct.vBMD~1074--1432,Ct.Ar/Tt.Ar~97--100%). -
Facet wrapping for many measures:
plot_groups()now caps facet
columns at 5 per row (viancol = min(n_measures, 5)) instead of forcing
all facets into a single row. This prevents facet labels from being clipped
when plotting the 9 default cortical measures. Trabecular plots (4 default
measures) are unaffected.
Interactive data tables
print_data(): New exported function that wrapsDT::datatable()to
display raw bone microCT data as interactive, sortable, searchable tables
in the Data tabs of the R Markdown templates. Each sex is displayed as a
separate table. Metadata columns (Animal ID,Site) are dropped and rows
are ordered by treatment/genotype group.
Template changes
- Version stamp: All four R Markdown templates now include a statement in
the Session Info section linking to the specific version of klct used to
generate the report, with links to the pkgdown site and the corresponding
GitHub release tag.
Dependencies
- Added
ggsignifto Imports (forgeom_signif()comparison brackets in
plot_groups()).
klct v0.2.0
Statistical method improvements
-
Welch's t-test by default: All parametric pairwise comparisons now
always use Welch's t-test (unequal variances assumed). The preliminary
F-test for equal variances (var.test()) has been removed, as it inflates
Type I error rates. This affectscompare_groups(),compare_groups_2x2(),
andplot_groups(). -
Type III sums of squares:
compare_groups_2x2()now uses
lm()+car::Anova(type = "III")with sum-to-zero contrasts instead of
stats::aov()(which uses Type I sequential SS). This gives correct tests
for main effects and interactions with unbalanced designs. -
Benjamini--Hochberg adjusted p-values: A
P.adjcolumn is now
included in all results tables. Incompare_groups(), pairwise p-values
are BH-adjusted per sex across all measures at a site. In
compare_groups_2x2(), omnibus p-values are BH-adjusted per factor across
measures, and pairwise p-values are BH-adjusted per sex across measures.
Significance stars (Sig) and red-color highlighting in the R Markdown
templates continue to be based on the raw (unadjusted) p-value, as the
report is intended for exploratory screening.
New output columns
-
Difference column: A
Diffcolumn shows the raw difference (group 2
minus group 1). For parametric results this is the difference in means; for
nonparametric results, the Hodges--Lehmann pseudomedian of pairwise
differences (fromwilcox.test(conf.int = TRUE)). -
95% confidence intervals:
CI.LowandCI.Highcolumns report the
95% CI bounds for the difference. For parametric comparisons these come from
Welch's t-test. For nonparametric comparisons these come from the Wilcoxon
rank-sum test withconf.int = TRUE. -
Effect size reporting: A
Pct.Changecolumn shows the percent change
of the second group relative to the first. For parametric results this is
based on group means; for nonparametric results, on group medians. -
SD column: Parametric results now include an
SDcolumn alongside the
existingSEMcolumn. -
Q1 and Q3 columns: Nonparametric results now report
Q1(25th
percentile) andQ3(75th percentile) instead ofIQR, giving a clearer
picture of the distribution's location and spread.
Dependencies
- Added
carto Imports (forcar::Anova()with Type III sums of squares).
Template changes
- The omnibus test label in
print_results_2x2()now reads "Type III ANOVA"
(parametric) and the pairwise label reads "Welch's t-test" to reflect the
updated methods. - R Markdown templates no longer require all three data files (spine, metaphysis,
diaphysis) to be present. When a data file is missing, the corresponding
section is omitted from the report entirely rather than causing the report to
error. Only the mouse table is required. - The
knit:function reference in standard (non-Mayo) templates has been
corrected frommicroctr::knit_with_colored_textto
klct::knit_with_colored_text.
klct v0.1.0
- This is the first functional release of klct, containing the ability to
analyze NeoScan microCT data comparing two treatment groups. - Sites analyzed include femoral metaphysis (trabecular and cortical), femoral
diaphysis (cortical), and lumbar vertebra (trabecular). - Supports both parametric and nonparametric statistical tests via the
test
parameter ("parametric"or"nonparametric"):- Two-treatment comparisons (
compare_groups()): Student's t-test or
Wilcoxon rank-sum test. - Two-way Treatment × Sex comparisons (
compare_groups_2x2()): two-way
ANOVA or Aligned Rank Transform viaARTool::art().
- Two-treatment comparisons (
- Dynamic measure detection:
detect_trabecular_measures()matches^Tb.
columns;detect_cortical_measures()captures all other numeric non-metadata
columns. A shared internal helper.resolve_measures()centralizes measure
resolution across all analysis and plotting functions. - The
measuresparameter (available incompare_groups(),
compare_groups_2x2(), andplot_groups()) acceptsNULLfor sensible
defaults,"all"for all detected columns, or a custom character vector.
default_trabecular_measuresanddefault_cortical_measuresare exported. - Omnibus tables in two-way results are trimmed to
Factor,P, andSig
columns only. - Pairwise comparisons are merged directly into the Group Summaries table
(blank for the first group, p-value and significance stars for the second
group within each sex), matching thecompare_groups()convention. The table
heading reflects the test used (t-test or Wilcoxon). - Includes four R Markdown templates:
- "Compare Two Treatments" for analyzing each sex separately.
- "Compare Two Treatments (Mayo)" — Mayo-themed version using
mayodown::mayohtml. - "Compare Two Treatments and Two Sexes" for a full two-way design.
- "Compare Two Treatments and Two Sexes (Mayo)" — Mayo-themed version
usingmayodown::mayohtml.
- Template features:
- Parametric and nonparametric results are displayed as separate tabs.
- By-sex plot tabs are consolidated into a single tab (differing only in
significance annotations). - Combined Sexes Plots tabs are included in all sections.
- All templates accept a
testparameter in the YAML header.
- Mayo-themed templates use the
mayodownpackage for consistent branding,
including the Mayo logo, color scheme, and copyright footer. - The
color-text.luaPandoc filter is provided bymayodown, enabling
colored significance annotations in all template formats.