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.
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
)A tibble with one row per person (and group/strata) containing:
Decayed teeth (coronal)
Filled teeth (not decayed)
Missing teeth
Decayed or filled teeth
Decayed + missing + filled teeth
Count of teeth present
Root-decayed teeth (only when root_lesion_col is set)
Binary indicators
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.
"long" (default) or "wide". See Details.
Person-identifier column (default "record_id").
Optional grouping column(s) for repeated measures, e.g.
"redcap_event_name". Character vector.
Optional stratification column(s), e.g. "treatment". The
output will include these columns for downstream group summaries.
Column names for ICDAS codes (long format).
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).
Character vector of surface names considered root
surfaces. Default c("rootb","rootl","rootm","rootd").
Numeric vectors defining clinical code categories. Defaults match ICDAS.
See the Diagnostic threshold section for decayed_codes.
Numeric vector for root caries codes (default
same as decayed_codes).
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.
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.
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).
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.