| Title: | Read and Tidy 'GEDCOM' Genealogy Files |
|---|---|
| Description: | Reads and parses 'GEDCOM' (Genealogical Data Communication) files, the standard interchange format exported by genealogical software, and converts them into tidy data frames. Individuals, families, life events, and parent-child links are extracted into rectangular structures suitable for pedigree and kinship analysis. Additional helpers summarize file contents, convert place coordinates, and repair malformed records. Wikipedia family tree templates can be parsed into the same tidy structure. For a discussion of these and related data structures see [Hunter et al. (2026) <doi:10.1007/s10519-026-10259-z>]. |
| Authors: | S. Mason Garrison [aut, cre, cph] (ORCID: <https://orcid.org/0000-0002-4804-6003>), Christian Waugh [aut, dtc] (ORCID: <https://orcid.org/0000-0002-7871-5845>) |
| Maintainer: | S. Mason Garrison <[email protected]> |
| License: | GPL-3 |
| Version: | 0.2.0 |
| Built: | 2026-10-10 13:13:24 UTC |
| Source: | https://github.com/r-computing-lab/tidygedcom |
A function to add a new person to an existing pedigree data.frame.
addPersonToPed( ped, name = NULL, sex = NULL, momID = NA, dadID = NA, twinID = NULL, personID = NULL, zygosity = NULL, notes = NULL, url = NULL, overwrite = FALSE )addPersonToPed( ped, name = NULL, sex = NULL, momID = NA, dadID = NA, twinID = NULL, personID = NULL, zygosity = NULL, notes = NULL, url = NULL, overwrite = FALSE )
ped |
A |
name |
Optional. A character string representing the name of the new
person. If not provided, the name will be set to |
sex |
A value representing the sex of the new person. |
momID |
Optional. The ID of the mother of the new person. If not
provided, it will be set to |
dadID |
Optional. The ID of the father of the new person. If not
provided, it will be set to |
twinID |
Optional. The ID of the twin of the new person. If not
provided, it will be set to |
personID |
Optional. The ID of the new person. If not provided, it will be generated as the maximum existing personID + 1. |
zygosity |
Optional. A character string indicating the zygosity of the
new person. If not provided, it will be set to |
notes |
Optional. A character string for notes about the new person. If
not provided, it will be set to |
url |
Optional. A URL column for the new person. If not provided, it
will be set to |
overwrite |
Logical. If |
A data.frame with the new person added to the existing pedigree.
Iterates over a list of tag mappings and, if a tag matches the line, updates the record. Stops after the first match.
applyTagMappings(line, record, pattern_rows, tag_mappings)applyTagMappings(line, record, pattern_rows, tag_mappings)
line |
A character string from the GEDCOM file. |
record |
A named list representing the individual's record. |
pattern_rows |
A list with GEDCOM tag counts. |
tag_mappings |
A list of lists. Each sublist should define:
- |
A list with the updated record (record) and a logical flag (matched).
Converts all latitude and longitude columns in a parsed GEDCOM data frame from GEDCOM compass-prefix notation (e.g., '"N51.5074"', '"W0.1278"') to signed decimal degrees. By default, all columns whose names end in '_lat' or '_long' are converted.
convertGedcomCoords(df, lat_cols = NULL, long_cols = NULL)convertGedcomCoords(df, lat_cols = NULL, long_cols = NULL)
df |
A data frame, typically returned by |
lat_cols |
Character vector of latitude column names to convert. Defaults to all columns ending in '"_lat"'. |
long_cols |
Character vector of longitude column names to convert. Defaults to all columns ending in '"_long"'. |
The data frame with the specified columns replaced by numeric values.
df <- data.frame( birth_lat = "N51.5074", birth_long = "W0.1278", stringsAsFactors = FALSE ) convertGedcomCoords(df)df <- data.frame( birth_lat = "N51.5074", birth_long = "W0.1278", stringsAsFactors = FALSE ) convertGedcomCoords(df)
Counts the number of lines in a file (passed as a data frame with column "X1") that match various GEDCOM patterns. Returns a list with counts for each pattern.
countPatternRows(file)countPatternRows(file)
file |
A data frame with a column |
A list with counts of specific GEDCOM tag occurrences.
Extracts a four-digit year from a GEDCOM date string, stripping calendar escapes (e.g., '\@#DGREGORIAN\@') and common qualifiers ('ABT', 'BEF', 'AFT', 'BET'/'AND') before searching for the year. Returns 'NA_integer_' when no year is found. The function can be used to extract years from various GEDCOM date formats, including approximate dates and date ranges.
extractGedcomYear(x, year_len = 4)extractGedcomYear(x, year_len = 4)
x |
Character vector of GEDCOM date strings. |
year_len |
Integer specifying the length of the year to extract (default is 4). |
Integer vector of years.
extractGedcomYear(c("ABT 1 JAN 1900", "BEF 31 DEC 2000", "1850", NA))extractGedcomYear(c("ABT 1 JAN 1900", "BEF 31 DEC 2000", "1850", NA))
Searches a named list of data frames for the supplied IDs, looking in every column whose name matches 'id_regex' (parent, spouse, and person-ID columns by default). Returns one row per hit, recording which dataset, which column, and which row the ID was found in, alongside any requested context columns. This is the detective step of link repair: locating every place an ID lives before deciding how to fix it.
findIDs( data_list, ID, id_regex = "(^id$|id$|^pid|pid$|pid_|dadid|momid|patid|matid|spid|spouse|sire|dame)", context_cols = c("sex", "byr", "dyr", "name"), ignore_case = TRUE, include_all_id_cols = FALSE )findIDs( data_list, ID, id_regex = "(^id$|id$|^pid|pid$|pid_|dadid|momid|patid|matid|spid|spouse|sire|dame)", context_cols = c("sex", "byr", "dyr", "name"), ignore_case = TRUE, include_all_id_cols = FALSE )
data_list |
A named list of data frames to search. |
ID |
A vector of one or more IDs to search for. |
id_regex |
Regular expression matched against column names to decide which columns are ID columns. Ignored when 'include_all_id_cols = TRUE'. |
context_cols |
Character vector of additional (non-ID) columns to carry through for context. Columns absent from a given data frame are ignored. |
ignore_case |
Logical. Match 'id_regex' case-insensitively. Default 'TRUE'. |
include_all_id_cols |
Logical. If 'TRUE', search every column rather than only those matching 'id_regex'. Default 'FALSE'. |
Unlike [sliceByID()], this does *not* standardize column names, because its whole purpose is to catch IDs wherever they hide, including in non-canonical columns.
A data frame with one row per match, containing 'matched_id', 'dataset', 'matched_column', 'matched_value', the source 'row_index', and any available 'context_cols'. Returns an empty data frame if nothing matches.
clean <- readGedcom( system.file("extdata", "waugh.ged", package = "tidygedcom"), verbose = FALSE ) messy <- readGedcom( system.file("extdata", "waugh_messy.ged", package = "tidygedcom"), verbose = FALSE ) # Locate every reference to W. Henderson Waugh across both parses findIDs(list(clean = clean, messy = messy), ID = 3)clean <- readGedcom( system.file("extdata", "waugh.ged", package = "tidygedcom"), verbose = FALSE ) messy <- readGedcom( system.file("extdata", "waugh_messy.ged", package = "tidygedcom"), verbose = FALSE ) # Locate every reference to W. Henderson Waugh across both parses findIDs(list(clean = clean, messy = messy), ID = 3)
Converts GEDCOM-style latitude strings like '"N51.5074"' or '"S33.8688"' to signed decimal degrees. Returns 'NA' for 'NA' or unrecognized-prefix input.
gedcomLat2Numeric(x)gedcomLat2Numeric(x)
x |
Character vector of GEDCOM latitude values. |
Numeric vector of decimal degrees (positive = N, negative = S).
gedcomLat2Numeric(c("N51.5074", "S33.8688", NA))gedcomLat2Numeric(c("N51.5074", "S33.8688", NA))
Converts GEDCOM-style longitude strings like '"E151.2093"' or '"W0.1278"' to signed decimal degrees. Returns 'NA' for 'NA' or unrecognized-prefix input.
gedcomLon2Numeric(x)gedcomLon2Numeric(x)
x |
Character vector of GEDCOM longitude values. |
Numeric vector of decimal degrees (positive = E, negative = W).
gedcomLon2Numeric(c("E151.2093", "W0.1278", NA))gedcomLon2Numeric(c("E151.2093", "W0.1278", NA))
Creates a named list with all GEDCOM initialized to NA_character_.
initializeRecord(all_var_names)initializeRecord(all_var_names)
all_var_names |
A character vector of variable names. |
A named list representing an empty individual record.
This function scans the data frame and creates a mapping of family IDs to the corresponding parent IDs.
mapFAMS2parents(df_temp, mom_sex = "F", dad_sex = "M")mapFAMS2parents(df_temp, mom_sex = "F", dad_sex = "M")
df_temp |
A data frame produced by |
mom_sex |
Character string indicating the value of sex that corresponds to mothers (default "F"). |
dad_sex |
Character string indicating the value of sex that corresponds to fathers (default "M"). |
A list mapping family IDs to parent information.
Extracts event details (e.g., date, place, cause, latitude, longitude) from a block of GEDCOM lines. Uses level-aware sub-block parsing so fields are looked up by tag name rather than fixed offsets.
processEventLine(event, block, i, record, pattern_rows, event_fields)processEventLine(event, block, i, record, pattern_rows, event_fields)
event |
A character string indicating the event type ("birth", "chr", "death", or "burial"). |
block |
A character vector of GEDCOM lines. |
i |
The current line index where the event tag is found. |
record |
A named list representing the individual's record. |
pattern_rows |
A list with counts of GEDCOM tag occurrences. |
event_fields |
A named list of field mappings as returned by
|
The updated record with parsed event information.
Ingests a GEDCOM genealogy file, identifies individual records, and parses person-level identifiers, names, life events, attributes, and family relationships into a structured data frame. Optional post-processing can infer parental IDs from family relationships, reconcile redundant name fields, and remove uninformative columns from the parsed output.
readGedcom( file_path, verbose = FALSE, post_process = TRUE, add_parents = TRUE, remove_empty_cols = TRUE, combine_cols = TRUE, skinny = FALSE, parse_dates = FALSE, impute_partial_dates = TRUE, clean_names = TRUE, update_rate = 1000, ... ) readGed( file_path, verbose = FALSE, post_process = TRUE, add_parents = TRUE, remove_empty_cols = TRUE, combine_cols = TRUE, skinny = FALSE, parse_dates = FALSE, impute_partial_dates = TRUE, clean_names = TRUE, update_rate = 1000, ... ) readgedcom( file_path, verbose = FALSE, post_process = TRUE, add_parents = TRUE, remove_empty_cols = TRUE, combine_cols = TRUE, skinny = FALSE, parse_dates = FALSE, impute_partial_dates = TRUE, clean_names = TRUE, update_rate = 1000, ... )readGedcom( file_path, verbose = FALSE, post_process = TRUE, add_parents = TRUE, remove_empty_cols = TRUE, combine_cols = TRUE, skinny = FALSE, parse_dates = FALSE, impute_partial_dates = TRUE, clean_names = TRUE, update_rate = 1000, ... ) readGed( file_path, verbose = FALSE, post_process = TRUE, add_parents = TRUE, remove_empty_cols = TRUE, combine_cols = TRUE, skinny = FALSE, parse_dates = FALSE, impute_partial_dates = TRUE, clean_names = TRUE, update_rate = 1000, ... ) readgedcom( file_path, verbose = FALSE, post_process = TRUE, add_parents = TRUE, remove_empty_cols = TRUE, combine_cols = TRUE, skinny = FALSE, parse_dates = FALSE, impute_partial_dates = TRUE, clean_names = TRUE, update_rate = 1000, ... )
file_path |
Character string. Path to the GEDCOM file. |
verbose |
Logical. If 'TRUE', print progress messages. |
post_process |
Logical. If 'TRUE', apply post-processing steps controlled by 'add_parents', 'combine_cols', 'remove_empty_cols', 'skinny', and 'parse_dates'. |
add_parents |
Logical. If 'TRUE', infer 'momID' and 'dadID' from 'FAMC' and 'FAMS' mappings during post-processing. |
remove_empty_cols |
Logical indicating whether to remove columns that are entirely missing. |
combine_cols |
Logical. If 'TRUE', combine redundant name columns, such as 'name_given' with 'name_given_pieces' and 'name_surn' with 'name_surn_pieces', when their values do not conflict. |
skinny |
Logical. If 'TRUE', return a slimmer data frame by dropping 'FAMC', 'FAMS', and columns that are entirely 'NA' during post-processing. |
parse_dates |
Logical. If 'TRUE', attempt to parse date columns (e.g., 'birth_date', 'death_date') into Date objects, after removing common GEDCOM date qualifiers like "ABT", "BEF", and "AFT". |
impute_partial_dates |
Logical. Only used when 'parse_dates = TRUE'. If 'TRUE' (default), dates known only to the month or the year are completed with the midpoint of that interval (the 15th of a known month, or 15 June for a known year) so that they survive conversion to 'Date'. Historical records are often this imprecise, and without imputation such dates become 'NA'. Set to 'FALSE' to keep only dates that specify a day. The unmodified strings are always available by reading the file with 'parse_dates = FALSE'. |
clean_names |
Logical indicating whether to clean name columns by removing trailing slashes and squishing whitespace. |
update_rate |
Numeric. Intended rate at which progress messages should be printed. Currently unused. |
... |
Additional arguments. Currently unused. |
'readGedcom()' is a line-oriented parser tuned to common GEDCOM 5.5 and 5.5.1 structures. Individual records are identified from blocks that begin with an '@ INDI' line. Each individual block is passed to an internal parser that uses simple GEDCOM tag pattern matches to extract identifiers, names, life events, attributes, and family relationships.
Name information is parsed primarily from the GEDCOM 'NAME' tag, which often encodes given names and surnames using slash-delimited surname notation, such as 'NAME John /Smith/'. The parser extracts the given name, surname, and a cleaned full name. Additional name components are parsed when present, including name prefix, name suffix, nickname, and married surname.
Birth and death events are recognized from 'BIRT' and 'DEAT' tags. Event details are parsed by collecting all child lines whose GEDCOM level equals the event level plus one (direct children), then looking up sub-fields by tag name. 'DATE', 'PLAC', and 'CAUS' are matched as direct children of the event. Coordinates ('LATI' and 'LONG') are searched across all descendant lines, which allows them to be located whether they appear as direct children (common in some GEDCOM 5.5.x exporters), under 'PLAC' (standard GEDCOM 5.5.1), or under a 'MAP' substructure under 'PLAC' (GEDCOM 7.x). Missing sub-fields leave the corresponding output columns as 'NA'.
Attribute tags such as 'OCCU', 'EDUC', 'RELI', 'CAST', 'NCHI', 'NMR', 'NATI', 'RESI', 'PROP', 'SSN', 'TITL', 'DSCR', and 'IDNO' are parsed directly into dedicated columns prefixed with 'attribute_'.
Family relationships are parsed from 'FAMC' and 'FAMS' tags. 'FAMC' identifies the family in which an individual is a child, and 'FAMS' identifies families in which an individual is a spouse. These raw family identifiers are retained in the parsed output unless removed during post-processing. When 'add_parents = TRUE', they are also used to infer 'momID' and 'dadID'.
If 'post_process = TRUE', 'readGedcom()' applies optional cleanup steps controlled by 'add_parents', 'combine_cols', 'remove_empty_cols', and 'skinny'. These steps can infer parent IDs, collapse redundant name fields, remove columns that are entirely missing, and drop raw family relationship columns for a slimmer output.
A data frame containing information about individuals, with the following potential columns:
Individual ID parsed from the '@ INDI' line.
ID of the individual's mother, if inferred.
ID of the individual's father, if inferred.
Sex of the individual.
Cleaned full name of the individual.
Given name parsed from the 'NAME' tag.
Given name parsed from a separate 'GIVN' tag, if present.
Surname parsed from the 'NAME' tag.
Surname parsed from a separate 'SURN' tag, if present.
Married surname parsed from '_MARNM', if present.
Nickname parsed from 'NICK', if present.
Name prefix parsed from 'NPFX', if present.
Name suffix parsed from 'NSFX', if present.
Birth date of the individual.
Latitude of the birthplace.
Longitude of the birthplace.
Birthplace of the individual.
Christening date of the individual ('CHR' tag).
Christening place of the individual.
Cause of death.
Death date of the individual.
Latitude of the place of death.
Longitude of the place of death.
Place of death of the individual.
Burial date of the individual ('BURI' tag).
Latitude of the burial place.
Longitude of the burial place.
Burial place of the individual.
Caste of the individual.
Number of children of the individual.
Description of the individual.
Education of the individual.
Identification number of the individual.
Number of marriages of the individual.
Nationality of the individual.
Occupation of the individual.
Property owned by the individual.
Religion of the individual.
Residence of the individual.
Social Security number of the individual.
Title of the individual.
ID or IDs of the family in which the individual is a child.
ID or IDs of families in which the individual is a spouse.
If no individual records are found, the function returns 'NULL' with a warning.
# A small excerpt of the W. Henderson Waugh family tree ged_file <- system.file("extdata", "waugh.ged", package = "tidygedcom") ped <- readGedcom(ged_file, verbose = FALSE) ped[, c("personID", "name", "sex", "birth_date", "momID", "dadID")] # Keep every parsed column rather than the default slimmed output full <- readGedcom(ged_file, verbose = FALSE, remove_empty_cols = FALSE) ncol(full)# A small excerpt of the W. Henderson Waugh family tree ged_file <- system.file("extdata", "waugh.ged", package = "tidygedcom") ped <- readGedcom(ged_file, verbose = FALSE) ped[, c("personID", "name", "sex", "birth_date", "momID", "dadID")] # Keep every parsed column rather than the default slimmed output full <- readGedcom(ged_file, verbose = FALSE, remove_empty_cols = FALSE) ncol(full)
Parses 'FAM' records from a GEDCOM file and returns a tidy data frame with one row per family unit. Captures husband, wife, children, marriage event, and divorce event details.
readGedcomFamilies( file_path, verbose = FALSE, parse_dates = FALSE, remove_empty_cols = TRUE, ... )readGedcomFamilies( file_path, verbose = FALSE, parse_dates = FALSE, remove_empty_cols = TRUE, ... )
file_path |
Character string. Path to the GEDCOM file. |
verbose |
Logical. If 'TRUE', print progress messages. |
parse_dates |
Logical. If 'TRUE', attempt to parse 'marr_date' and 'div_date' into 'Date' objects, after stripping common GEDCOM qualifiers. |
remove_empty_cols |
Logical indicating whether to remove columns that are entirely missing. |
... |
Additional arguments. Currently unused. |
A data frame with one row per 'FAM' record and the following columns:
Family identifier from the '@ FAM' line.
Person ID of the husband ('HUSB' tag).
Person ID of the wife ('WIFE' tag).
Comma-separated person IDs of children ('CHIL' tags).
Marriage date ('MARR/DATE').
Marriage place ('MARR/PLAC').
Marriage latitude ('MARR/.../LATI').
Marriage longitude ('MARR/.../LONG').
Divorce date ('DIV/DATE').
Divorce place ('DIV/PLAC').
Returns 'NULL' with a warning if no family records are found.
fam <- readGedcomFamilies( system.file("extdata", "waugh.ged", package = "tidygedcom"), verbose = FALSE ) famfam <- readGedcomFamilies( system.file("extdata", "waugh.ged", package = "tidygedcom"), verbose = FALSE ) fam
Read Wiki Family Tree
readWikifamilytree(text = NULL, verbose = FALSE, file_path = NULL, ...)readWikifamilytree(text = NULL, verbose = FALSE, file_path = NULL, ...)
text |
A character string containing the text of a family tree in wiki format. |
verbose |
A logical value indicating whether to print messages. |
file_path |
The path to the file containing the family tree. |
... |
Additional arguments (not used). |
A list containing the summary, members, structure, and relationships of the family tree.
tree_text <- paste( "{{familytree/start |summary=A three-generation example.}}", "{{familytree | | | | GMa |~|y|~| GPa | | GMa=Gladys|GPa=Sydney}}", "{{familytree | | | | | | | |)|-|-|-|.| }}", "{{familytree | | | MOM |y| DAD | |AUNT| MOM=Mom|DAD=Dad|AUNT=Aunt Daisy}}", "{{familytree | |,|-|-|-|.| | | | | | }}", "{{familytree | JOE | | ME | | JOE=Joe|ME=Me}}", "{{familytree/end}}", sep = "\n" ) tree <- readWikifamilytree(text = tree_text) tree$summary head(tree$members)tree_text <- paste( "{{familytree/start |summary=A three-generation example.}}", "{{familytree | | | | GMa |~|y|~| GPa | | GMa=Gladys|GPa=Sydney}}", "{{familytree | | | | | | | |)|-|-|-|.| }}", "{{familytree | | | MOM |y| DAD | |AUNT| MOM=Mom|DAD=Dad|AUNT=Aunt Daisy}}", "{{familytree | |,|-|-|-|.| | | | | | }}", "{{familytree | JOE | | ME | | JOE=Joe|ME=Me}}", "{{familytree/end}}", sep = "\n" ) tree <- readWikifamilytree(text = tree_text) tree$summary head(tree$members)
Applies a set of manual corrections to a pedigree data frame, recording the provenance of each edit in 'manual_fix' and 'manual_fix_comment' columns and refusing to let two fixes silently touch the same row. This is the repair counterpart to BGmisc's automated [BGmisc::repairIDs()] / [BGmisc::repairSex()]: for the cases a human has to resolve by hand, it keeps the edits reproducible and auditable.
repairManually(ped, fixes)repairManually(ped, fixes)
ped |
A pedigree data frame. |
fixes |
A named list of fixes, each structured as described above. The names label each fix and are stored in 'manual_fix'. |
Each element of 'fixes' is itself a list with three parts:
A quoted expression (see [rlang::quo()]) that evaluates within 'ped' to a logical row selector, e.g. 'rlang::quo(ID == 348700)'.
A named list of 'column = new_value' pairs to assign to the selected rows.
A short human-readable note explaining the fix.
'ped' with the fixes applied and the 'manual_fix' / 'manual_fix_comment' provenance columns populated.
# The messy example file omits Laura Watkins's SEX line, so she cannot be # resolved as a mother during parsing. ped <- readGedcom( system.file("extdata", "waugh_messy.ged", package = "tidygedcom"), verbose = FALSE ) ped$sex[ped$personID == 6] fixes <- list( laura_sex = list( rows = rlang::quo(personID == 6), changes = list(sex = "F"), comment = "Sex absent from source export; confirmed by 1880 census." ) ) ped <- repairManually(ped, fixes) ped[ped$personID == 6, c("personID", "name", "sex", "manual_fix")]# The messy example file omits Laura Watkins's SEX line, so she cannot be # resolved as a mother during parsing. ped <- readGedcom( system.file("extdata", "waugh_messy.ged", package = "tidygedcom"), verbose = FALSE ) ped$sex[ped$personID == 6] fixes <- list( laura_sex = list( rows = rlang::quo(personID == 6), changes = list(sex = "F"), comment = "Sex absent from source export; confirmed by 1880 census." ) ) ped <- repairManually(ped, fixes) ped[ped$personID == 6, c("personID", "name", "sex", "manual_fix")]
This dataset builds on an existing dataset created by Denis Reid of the Royal Families of Europe. That data was originally published in 1992 and is available on the internet. This version has been updated to combine duplicate entries and to include additional information on birth and death dates, as well as titles. This dataset is intended for educational and illustrative use in software demonstrations involving pedigree diagrams, inheritance structures, and kinship modeling. This dataset is not intended to represent any real individuals or families beyond the original source data, and it is provided solely for educational purposes.
data(royal92)data(royal92)
A data frame with 3010 observations
The variables are as follows:
personID: Person identification variable
momID: ID of the mother
dadID: ID of the father
famID: ID of the extended family
twinID: ID of the twin, if applicable
name: Name of the person
sex: Biological sex
birth_date: Date of birth
death_date: Date of death
title: Title of the person
Given a pedigree data frame, returns every row in which any of the supplied IDs appears as the individual themselves, a parent, or a spouse. This is a diagnostic aid for inspecting a person's full household before and after manually repairing links in GEDCOM-derived pedigrees. The result is a subset of 'ped' with the same columns..
sliceByID(ped, ID, sort = TRUE)sliceByID(ped, ID, sort = TRUE)
ped |
A pedigree data frame. |
ID |
A vector of one or more IDs to slice on. |
sort |
Logical. If 'TRUE' (default), sort the result by father ID then individual ID. |
Incoming column names are normalized with BGmisc's internal column standardizer, so the common variants ('ID'/'personID', 'dadID'/'pid_fath', 'momID'/'pid_moth', 'spID'/'pid_spouse1', ...) are all recognized without the caller naming them. Because BGmisc's canonical schema is single-spouse but GEDCOM-derived pedigrees often record remarriages in extra columns, any additional spouse-like columns (matching 'spID2', 'pid_spouse2', ...) are detected and searched too. The returned rows keep the caller's original column names.
A data frame: the subset of 'ped' rows in which any of 'ID' appears in a linking column, with the original columns and names preserved.
ped <- readGedcom( system.file("extdata", "waugh.ged", package = "tidygedcom"), verbose = FALSE ) # Inspect William Pitt Waugh Sr. and everyone linked to him sliceByID(ped, ID = 1)ped <- readGedcom( system.file("extdata", "waugh.ged", package = "tidygedcom"), verbose = FALSE ) # Inspect William Pitt Waugh Sr. and everyone linked to him sliceByID(ped, ID = 1)
Returns key counts and coverage statistics for a data frame produced by
readGedcom().
summarizeGedcom(df)summarizeGedcom(df)
df |
A data frame returned by |
An object of class "tidygedcom_summary" (a named list).
Print the result for a human-readable overview.
df <- readGedcom( system.file("extdata", "waugh.ged", package = "tidygedcom"), verbose = FALSE ) summarizeGedcom(df) # Coverage drops on a file with missing records messy <- readGedcom( system.file("extdata", "waugh_messy.ged", package = "tidygedcom"), verbose = FALSE ) summarizeGedcom(messy)df <- readGedcom( system.file("extdata", "waugh.ged", package = "tidygedcom"), verbose = FALSE ) summarizeGedcom(df) # Coverage drops on a file with missing records messy <- readGedcom( system.file("extdata", "waugh_messy.ged", package = "tidygedcom"), verbose = FALSE ) summarizeGedcom(messy)
A count-level companion to [findIDs()]: instead of one row per hit, returns one row per (id, dataset, column) with the number of matches. Useful for a quick census of how many places an ID appears before drilling in with [findIDs()].
summarizeIDs(data_list, ID, ...) summariseIDs(data_list, ID, ...)summarizeIDs(data_list, ID, ...) summariseIDs(data_list, ID, ...)
data_list |
A named list of data frames to search. |
ID |
A vector of one or more IDs to search for. |
... |
Additional arguments passed to [findIDs()]. |
A data frame with columns 'matched_id', 'dataset', 'matched_column', and 'n_matches'.
clean <- readGedcom( system.file("extdata", "waugh.ged", package = "tidygedcom"), verbose = FALSE ) messy <- readGedcom( system.file("extdata", "waugh_messy.ged", package = "tidygedcom"), verbose = FALSE ) # Count references per dataset and column summarizeIDs(list(clean = clean, messy = messy), ID = 3)clean <- readGedcom( system.file("extdata", "waugh.ged", package = "tidygedcom"), verbose = FALSE ) messy <- readGedcom( system.file("extdata", "waugh_messy.ged", package = "tidygedcom"), verbose = FALSE ) # Count references per dataset and column summarizeIDs(list(clean = clean, messy = messy), ID = 3)
Trace paths between individuals in a family tree grid
traceTreePaths(tree_long, deduplicate = TRUE)traceTreePaths(tree_long, deduplicate = TRUE)
tree_long |
A data.frame with columns: Row, Column, Value, id |
deduplicate |
Logical, if TRUE, will remove duplicate paths |
A data.frame with columns: from_id, to_id, direction, path_length, intermediates
# Two individuals joined by a horizontal connector tree_long <- data.frame( Row = rep(1, 3), Column = 1:3, Value = c("A", "+", "B"), id = c("A", NA, "B") ) traceTreePaths(tree_long)# Two individuals joined by a horizontal connector tree_long <- data.frame( Row = rep(1, 3), Column = 1:3, Value = c("A", "+", "B"), id = c("A", NA, "B") ) traceTreePaths(tree_long)