Learn R Programming

tooth (version 0.5.0)

calc_dmft: Calculate DMFT / dmft index from surface- or tooth-level data

Description

Computes Decayed, Missing, and Filled Teeth counts per person. Handles both primary and permanent dentition. Can separate root caries from coronal caries. Accepts long or wide format data.

Usage

calc_dmft(
  data,
  format = c("long", "wide"),
  id = "record_id",
  group = NULL,
  strata = NULL,
  lesion_col = "lesion_code",
  activity_col = "act",
  filling_col = "filling_code",
  tooth_code_col = "code",
  root_lesion_col = NULL,
  root_surfaces = c("rootb", "rootl", "rootm", "rootd"),
  decayed_codes = c(3, 4, 5, 6),
  activity_codes = c(2),
  filled_codes = c(1, 2, 4, 5, 6, 7, 8),
  present_codes = c(2, 3, 4, 5, 6, 7, 8),
  missing_codes = c(1),
  root_decayed_codes = NULL,
  consider_activity = TRUE,
  consider_activity_coronal = NULL,
  consider_activity_root = NULL
)

Value

A tibble with one row per person (and group/strata) containing:

DT

Decayed teeth (coronal)

FT

Filled teeth (not decayed)

MT

Missing teeth

DFT

Decayed or filled teeth

DMFT

Decayed + missing + filled teeth

num_teeth

Count of teeth present

RDT

Root-decayed teeth (only when root_lesion_col is set)

DT_yn, DFT_yn

Binary indicators

Arguments

data

Data frame. In long format: one row per tooth-surface with columns for id, tooth_num, tooth_surface, and clinical codes. In wide format: one row per person-tooth with surface codes in separate columns.

format

"long" (default) or "wide". See Details.

id

Person-identifier column (default "record_id").

group

Optional grouping column(s) for repeated measures, e.g. "redcap_event_name". Character vector.

strata

Optional stratification column(s), e.g. "treatment". The output will include these columns for downstream group summaries.

lesion_col, activity_col, filling_col, tooth_code_col

Column names for ICDAS codes (long format).

root_lesion_col

Optional column for root surface lesion codes. When provided, root caries (RDT) is calculated separately from coronal (DT). Set to NULL to ignore root caries (default).

root_surfaces

Character vector of surface names considered root surfaces. Default c("rootb","rootl","rootm","rootd").

decayed_codes, activity_codes, filled_codes, present_codes, missing_codes

Numeric vectors defining clinical code categories. Defaults match ICDAS. See the Diagnostic threshold section for decayed_codes.

root_decayed_codes

Numeric vector for root caries codes (default same as decayed_codes).

consider_activity

Logical; overall default for whether a lesion must also carry an active-caries code (activity_codes) to be counted as decayed. TRUE (default) requires activity; FALSE counts any lesion in decayed_codes regardless of activity. Standard epidemiological D(3)MFT counts all cavitated lesions irrespective of activity, so set FALSE to match that convention. When FALSE, the activity column is not referenced and need not be present.

consider_activity_coronal, consider_activity_root

Optional logical overrides for the coronal and root components. NULL (default) inherits consider_activity. Use these to treat crown and root caries differently (e.g. require activity coronally but not for roots, where activity is often not assessed): consider_activity_root = FALSE.

Diagnostic threshold

The default decayed_codes = c(3, 4, 5, 6) implements the D3 threshold: only ICDAS codes 3–6 (localised enamel breakdown through extensive cavitation) are scored as decayed, while ICDAS 1–2 (non-cavitated initial enamel lesions) are treated as sound. This D(3)MFT convention is the one most commonly reported in caries epidemiology. To use the more sensitive D1 threshold that also counts early enamel lesions, pass decayed_codes = c(1, 2, 3, 4, 5, 6).

Wide format

When format = "wide", each row is one person (and optional group). You must supply columns named like {tooth}_{surface}_{code_type} or use the wide_cols parameter. Alternatively, pass a pivot_spec — but the easiest approach is to reshape to long with pivot_to_long() first.