knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
Families can be difficult - but the data describing them doesn't need to be
Create and summarise family tree GEDCOM files using tidy dataframes.
The package is part of the gedcompendium
ecosystem of packages. This ecosystem enables the handling of tidyged
objects (tibble representations of GEDCOM files), and the main package of this ecosystem is tidyged
.
knitr::include_graphics("man/figures/allhex.png")
You can install the development version from GitHub with:
# install.packages("remotes") remotes::install_github("jl5000/tidyged")
The intent is to allow the user to import GEDCOM files or create them from scratch using a ggplot2
type interface; starting with a base GEDCOM object (with only a header and trailer section) and adding records as you would add layers to a ggplot object (but instead using the pipe operator, |>).
An example is below:
library(tidyged) tg <- gedcom(subm("Jamie Lendrum"), gedcom_description = "The Skywalker family", gedcom_copyright = "None") |> add_indi(sex = "M", indi_notes = "The central character in the Star Wars Skywalker Saga") |> add_indi_names(name_pieces(given = "Anakin", surname = "Skywalker"), type = "birth") |> add_indi_names(name_pieces(prefix = "Darth", given = "Vader"), type = "given") |> add_indi(sex = "F", indi_notes = "Queen of Naboo") |> add_indi_names(name_pieces(given = "Padme", surname = "Amidala"), type = "birth") |> add_indi(sex = "F") |> add_indi_names(name_pieces(given = "Leia", surname = "Skywalker"), type = "birth") |> add_indi_names(name_pieces(prefix = "Princess", given = "Leia", surname = "Organa"), type = "adoptive") |> add_indi(sex = "M") |> add_indi_names(name_pieces(given = "Luke", surname = "Skywalker"), type = "birth") |> add_indi(sex = "M") |> add_indi_names(name_pieces(given = "Obi-Wan", nickname = "Ben", surname = "Kenobi"), type = "birth") anakin_xref <-find_indi_name(tg, "Anakin") padme_xref <-find_indi_name(tg, "Padme") luke_leia_xref <-find_indi_name_all(tg, "Luke|Leia") obiwan_xref <-find_indi_name(tg, "Obi-Wan") tg <- tg |> add_famg(husband = anakin_xref, wife = padme_xref, children = luke_leia_xref) |> activate_indi(anakin_xref) |> add_indi_association(obiwan_xref, association = "Master") |> add_indi_fact("death", age = "45y", cause = "Killed by son Luke", fact_place = place(name = "Second Death Star", notes = "Orbiting Endor System")) |> add_indi_fact("religion", descriptor = "Jedi") |> add_indi_fact("possession", descriptor = "Lightsaber") |> add_note("Based on Star Wars") |> add_sour(short_title = "Star Wars", title = "Star Wars Episode IV: A New Hope") |> add_repo("The Skywalker Saga") |> add_media(file_reference = "XYZ", format = "JPEG") print(tg, n = Inf)
Just like a ggplot object requires aesthetics, a GEDCOM file requires details of a submitter. If no submitter details are given, the username is used.
Within the package, GEDCOM files are represented as a sub-class of tibble known as tidyged
objects, allowing easy manipulation and exploitation of existing tidyverse
infrastructure.
A number of functions are available to provide summaries of tidyged
objects:
num_indi(tg) num_famg(tg) str(tg) summary(tg) df_indi(tg) |> knitr::kable() df_famg(tg) |> knitr::kable()
This package allows limited editing of tidyged
objects (adding/removing records, as well as the addition of some record substructures). Editing of existing records is made possible through 'activation' (much like the tidygraph
package). When a record is created, it automatically becomes the active record, through an object attribute. Record editing functions then act on this record. Other records can be activated through a series of activate_*()
functions.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.