| Title: | Working with dental data |
|---|---|
| Description: | A package to facilitate working with dental data and calculation of dental indices that are commonly used in dental anthropology. |
| Authors: | Bjørn Peare Bartholdy [aut, cre] (ORCID: <https://orcid.org/0000-0003-3985-1016>) |
| Maintainer: | Bjørn Peare Bartholdy <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.0.0.9000 |
| Built: | 2026-09-23 07:34:24 UTC |
| Source: | https://codeberg.org/bbartholdy/teethr |
Convenience function to calculate dental calculus index directly from a
dental_longer() output.
calculus_index(.data, ..., .score = score, .method = c("simple", "greene2005"))calculus_index(.data, ..., .score = score, .method = c("simple", "greene2005"))
.data |
Data frame in long format, with one tooth surface per row, and one calculus score per surface. |
... |
can be used to add arguments to |
.score |
numeric. Calculus score for each surface. Defaults to 'score' as provided by dental_longer. |
.method |
string. Using |
Calculate the calculus index for each quadrant of an individual based
on the method outlined in Greene et al. (2005). The original method calculates
a score for each quadrant of the dentition, so it is recommended to group by
quadrant, either in the function or using group_by above in a pipe (see examples).
The default returns a data frame with the supplied groups and calculations for number of surfaces scored, number of teeth scored, sum of scores, and the calculus index.
Greene, T.R., Kuba, C.L., Irish, J.D. 2005. Quantifying calculus: A suggested new approach for recording an important indicator of diet and dental health. doi:10.1016/j.jchb.2005.02.002
library(dplyr) mb11_calculus_long <- mb11_calculus %>% dental_longer(-id, names_sep = "_") %>% dental_join() # example adding groups before call to function mb11_calculus_long %>% group_by(id, quadrant) %>% calculus_index() # example adding groups in call to function mb11_calculus_long %>% calculus_index(id, quadrant) # example of the Greene et al. 2005 method mb11_calculus_long %>% calculus_index(.method = "greene2005")library(dplyr) mb11_calculus_long <- mb11_calculus %>% dental_longer(-id, names_sep = "_") %>% dental_join() # example adding groups before call to function mb11_calculus_long %>% group_by(id, quadrant) %>% calculus_index() # example adding groups in call to function mb11_calculus_long %>% calculus_index(id, quadrant) # example of the Greene et al. 2005 method mb11_calculus_long %>% calculus_index(.method = "greene2005")
Convert caries scores to lesion counts
count_caries( data, caries = score, no_lesion = NULL, lesion_sep = NULL, unobs = NA, method = c("location", "standards", "count") )count_caries( data, caries = score, no_lesion = NULL, lesion_sep = NULL, unobs = NA, method = c("location", "standards", "count") )
data |
data frame containing caries scores |
caries |
column containing caries scores |
no_lesion |
value used to indicate no caries lesions |
lesion_sep |
string. character used to separate multiple lesions. |
unobs |
value used to indicate unobservable |
method |
string. what method was used to score caries lesions. |
Used to map each tooth to geom_sf() to create a dental plot.
dental_arcade_mappingdental_arcade_mapping
dental_arcade_mappingA data frame with 32 rows and 2 columns:
string. Tooth with text notation.
sfc. Simple feature geometry list-column for mapping teeth to geom_sf().
...
https://github.com/ZandraFagernas/dental_arcade/blob/v0.1/dental_arcade_empty_mapping.jpg
Checks if the data frame satisfies the criterion that minimally, each surface must be scorable on at least one side of the dentition to obtain the index, then filters out groups that don't satisfy.
dental_filter(data, score = score)dental_filter(data, score = score)
data |
long format data frame with tooth position information and either lesion counts or scores. |
score |
Scores of a dental lesion (e.g. caries counts or dental calculus score). |
Returns a filtered data frame and a warning if any rows were removed.
Produce detailed tooth position information from tooth notation
dental_join(data, by = tooth, notation = c("FDI", "standards", "text"), ...)dental_join(data, by = tooth, notation = c("FDI", "standards", "text"), ...)
data |
A data frame containing a column with a unique identifier and one column per tooth or tooth surface. |
by |
string. name of column containing the tooth notation. |
notation |
string. Which notation convention is used to name the columns
with dental scores. Options are "FDI", "standards", "text". See the
|
... |
supply additional arguments to |
Returns the original data frame along with detailed information about the tooth including, region (maxilla, mandible), position (anterior, posterior), side, class (incisor, canine, etc.), type, (first incisor, second molar, etc.), and quadrant.
mb11_caries %>% dental_longer(-id) %>% dental_join()mb11_caries %>% dental_longer(-id) %>% dental_join()
This function is a wrapper for pivot_longer() that converts a wide format
data frame to a long format with tooth names in a tooth column
(and surface, if applicable) and the score in a score column. It also
attaches additional columns with information about the type of tooth and the
position of the tooth in the mouth (type, class, region, etc.).
dental_longer(data, cols, ...)dental_longer(data, cols, ...)
data |
A data frame containing a column with a unique identifier and one column per tooth or tooth surface. |
cols |
Which columns to pivot into longer format. These should be the columns containing the scores for each tooth/surface. |
... |
additional arguments passed on to |
If there are multiple columns per tooth, i.e., if teeth were scored per surface
and variables are named something like names_sep = "_" (or whatever character was used to separate tooth number from
tooth surface) should be passed to pivot_longer via .... If no such
separator was used, use instead names_pattern = <regex>. See
pivot_longer for more details.
Returns a longer data frame with one row per tooth or tooth surface, with columns for tooth number, region (maxilla, mandible), position (anterior, posterior), side, class (incisor, canine, etc.), type, and quadrant.
# pivot calculus scores per surface (all columns except id) # 't' prefix needs to be removed from column names mb11_calculus %>% dental_longer(-id, names_sep = "_") # pivot caries scores per tooth mb11_caries %>% dental_longer(-id)# pivot calculus scores per surface (all columns except id) # 't' prefix needs to be removed from column names mb11_calculus %>% dental_longer(-id, names_sep = "_") # pivot caries scores per tooth mb11_caries %>% dental_longer(-id)
Function to switch between tooth notations.
dental_recode(data, col, from, to)dental_recode(data, col, from, to)
data |
A data frame to convert |
col |
the column to convert. Must contain a tooth notation (e.g., FDI, standards). |
from |
string. the tooth notation of the original data. |
to |
string. The tooth notation you wish to convert to. |
Calculate a dental index, such as a calculus index, or ratio, such as caries ratio.
dental_index(data, score = score) dental_ratio(data, count = count)dental_index(data, score = score) dental_ratio(data, count = count)
data |
long format data frame with tooth position information and either lesion counts or scores. |
score |
Scores of a dental lesion (e.g. caries counts or dental calculus score). |
count |
Counts of a dental lesion (e.g. caries counts or dental calculus score). |
Function to calculate the index or ratio of dental diseases.
dental_ratio() is just a wrapper for dental_index()
where the output column 'index' is changed to 'count', and 'score_sum' to 'ratio'.
Returns a data frame containing the grouping variable(s), the number of teeth per group, the lesion count or sum of scores, and the calculated index or ratio.
dental_index(): calculate dental disease index
dental_ratio(): calculate dental disease ratio
library(dplyr) library(tidyr) # dental calculus index mb11_calculus %>% dental_longer(-id, names_sep = "_") %>% dental_join() %>% group_by(class) %>% # calculate index per tooth class dental_index()library(dplyr) library(tidyr) # dental calculus index mb11_calculus %>% dental_longer(-id, names_sep = "_") %>% dental_join() %>% group_by(class) %>% # calculate index per tooth class dental_index()
Dental calculus scores collected from Middenbeemster (MB11), a rural 19th century archaeological site in the Netherlands.
mb11_calculusmb11_calculus
mb11_calculusA data frame with 41 rows and 97 columns:
Skeletal ID
Calculus score per tooth surface. Variable naming:
t<tooth number (FDI notation)>_
...
https://doi.org/10.5281/zenodo.7649151
Dental caries lesions collected from Middenbeemster (MB11), a rural 19th century archaeological site in the Netherlands.
mb11_cariesmb11_caries
mb11_cariesA data frame with 41 rows and 33 columns:
Skeletal ID
Caries lesion location(s) per tooth. Multiple scores separated by ';'. Variable naming: t<tooth number (FDI notation)>. mes = mesial, dis = distal, buc = buccal; lin = lingual, occ = occlusal, root = root, crown = large lesion of indeterminate origin
...
https://doi.org/10.5281/zenodo.7649151
Age and sex of the individuals with dental calculus scored in mb11_calculus.
mb11_demographymb11_demography
mb11_demographyA data frame with 41 rows and 97 columns:
Skeletal ID
Age category of the individual. eya = early young adult (18-24); lya = late young adult (25-34); ma = middle adult (35-49); old = old adult (50+).
Biological sex of individual estimated using osteological methods. f = female; pf = probable female; pm = probable male; m = male.
...
https://doi.org/10.5281/zenodo.7649151
Used to convert between tooth naming conventions that are common in dental anthropology.
tooth_notationtooth_notation
tooth_notationA data frame with 32 rows and 9 columns:
Fédération dentaire internationale naming convention
Standards naming (Buikstra and Ubelaker 1994)
Text naming: [UL][LR][ICPM][1-3] = upper/lower; left/right; incisor/canine/premolar/molar; tooth type (1-4). Example: Upper left lateral incisor = ULI2
if the tooth is from the maxilla or mandible
if the tooth is anterior or posterior
if the tooth is from the left or right side
if the tooth is incisor, canine, premolar, or molar
if the tooth is central/lateral incisor, canine, first/second premolar, or first/second/third molar
Which quadrant of the mouth the tooth is from. Upper/lower anterior/posterior.
...
Buikstra, J. E., & Ubelaker, D. H. (1994). Standards for data collection from human skeletal remains. Arkansas Archaeological Survey Research Series No. 44. Fayetteville: Arkansas Archaeological Survey.