imed_analysis_set: Create a manuscript/synthesis-ready analysis set

View source: R/filter_guard.R

imed_analysis_setR Documentation

Create a manuscript/synthesis-ready analysis set

Description

This is the preferred entry point for quantitative analysis.

Usage

imed_analysis_set(
  x,
  comparability_class,
  matrix = NULL,
  mass_basis = NULL,
  metric_type = "Abundance",
  include_holds = FALSE
)

Arguments

x

An 'imed_db' object, as returned by 'imed_data()'.

comparability_class

The single 'Comparability_Class' to analyse (required).

matrix

Optional 'Matrix_Code' value(s) to keep.

mass_basis

Optional 'Mass_Basis' value(s) to keep.

metric_type

'Metric_Type' to keep (default '"Abundance"').

include_holds

If 'FALSE' (default), records flagged as scientific HOLDs are removed.

Value

A 'tibble' of the selected measurement records that passed the comparability check. It has the additional class 'imed_analysis_set' and the attribute 'comparability_class'. The function stops with an informative message if the selected records are not comparable.

Examples

toy <- data.frame(
  Study_ID = paste0("S", 1:12),
  Comparability_Class = "CLASS_A",
  Reported_Unit = "items/L",
  Metric_Type = "Abundance",
  Strict_Synthesis_Eligibility = "YES",
  Group = rep(c("g1", "g2"), 6),
  Mean = c(2.1, 3.4, 1.8, 4.0, 2.9, 3.1, 2.4, 3.8, 1.9, 3.3, 2.7, 4.2),
  SD = rep(c(0.6, 0.9), 6),
  N = rep(c(10, 12, 8), 4)
)
aset <- imed_analysis_set(toy, comparability_class = "CLASS_A")
class(aset)
nrow(aset)

imedR documentation built on Nov. 3, 2026, 5:08 p.m.