The examples show some challenges, work-around, and exploitation of the features of both the tiny_pedigree function and gt tables.
Initialize the needed packages.
Show the code
## Activate the Core Packageslibrary(tidyverse) ## Brings in a core of useful functionslibrary(gt) ## Tables## special librarieslibrary(kinship2) ## Core package to calculate and plotlibrary(R.devices) ## External plot files (e.g., PNG)library(tinypedigree) ## For the tiny_pedigree function
4.1 Eight Generations
There are a lot of individuals to fit on this pedigree diagram. Perhaps too many as the typesize, in particular, must be very small.
Note that there is an interaction between the typesize and fold parameters. Folding the names doesn’t help.
Warning: row (generation) spacing seems to be disrupted at the lowest row in a many-generation diagram if there are several individuals at the lowest level.
Show the code
data <-read_csv(col_names=TRUE, show_col_types=FALSE, file="ID, dad, mom, gender, born, died Charles Wentworth, NA, NA, male, 1648, 1780 Amariah Wentworth, Charles Wentworth, Bethiah Fenno, male, 1719, 1799 Bethiah Fenno, NA, NA, female, 1692, 1780 Rebecca Shepard, NA, NA, female, 1723, 1791 Elijah Wentworth, Amariah Wentworth, Rebecca Shepard, male, 1775, 1810 Elijah S. Estes, NA, NA, male, 1814, 1887 Zebiah Walker Wentworth, Elijah Wentworth, Lucy Walker, female, 1810, 1887 Lucy Walker, NA, NA, female, NA, NA Mary Adeline Palmer, NA, NA, female, 1848, 1918 Lorenzo Langston Estes, Elijah S. Estes, Zebiah Walker Wentworth, male, 1839, 1909 Addie Estes, Lorenzo Langston Estes, Mary Adeline Palmer, female, NA, NA Charles A. Bridges, NA, NA, male, 1877, NA Charles L. Bridges, Charles A. Bridges, Addie Estes, male, 1912, 2001 Mary Jane Bridges, NA, NA, female, 1912, 2016 Thomas Bridges, Charles L. Bridges, Mary Jane Bridges, male, 1938, NA Kent Bridges, Charles L. Bridges, Mary Jane Bridges, male, 1941, NA")## Assign or calculate enhancementsdata$hilite <-TRUEdata <- data |>mutate(color =case_when( gender =="female"~"lightblue", gender =="male"~"lightsalmon1"))## Create a presentation tablegt(data) |>cols_hide(columns =c(dad, mom, gender, hilite, color)) |>tab_source_note(source_note="Source: Bridges family documents")
Breaking the pedigree into smaller sets is a way around some of the limitations seen in the last pedigree diagram.
Show the code
## Divide the data into two halves## First Halfdata1 <-read_csv(col_names=TRUE, show_col_types=FALSE, file="ID, dad, mom, gender, born, died Charles Wentworth, NA, NA, male, 1648, 1780 Amariah Wentworth, Charles Wentworth, Bethiah Fenno, male, 1719, 1799 Bethiah Fenno, NA, NA, female, 1692, 1780 Rebecca Shepard, NA, NA, female, 1723, 1791 Elijah Wentworth, Amariah Wentworth, Rebecca Shepard, male, 1775, 1810 Elijah S. Estes, NA, NA, male, 1814, 1887 Zebiah Walker Wentworth, Elijah Wentworth, Lucy Walker, female, 1810, 1887 Lucy Walker, NA, NA, female, NA, NA Lorenzo Langston Estes, Elijah S. Estes, Zebiah Walker Wentworth, male, 1839, 1909")## Second Halfdata2 <-read_csv(col_names=TRUE, show_col_types=FALSE, file="ID, dad, mom, gender, born, died Mary Adeline Palmer, NA, NA, female, 1848, 1918 Lorenzo Langston Estes, NA, NA, male, 1839, 1909 Addie Estes, Lorenzo Langston Estes, Mary Adeline Palmer, female, NA, NA Charles A. Bridges, NA, NA, male, 1877, NA Charles L. Bridges, Charles A. Bridges, Addie Estes, male, 1912, 2001 Mary Jane Bridges, NA, NA, female, 1912, 2016 Thomas Bridges, Charles L. Bridges, Mary Jane Bridges, male, 1938, NA Kent Bridges, Charles L. Bridges, Mary Jane Bridges, male, 1941, NA")## Assign or calculate enhancements to the first halfdata1$hilite <-TRUEdata1 <- data1 |>mutate(color =case_when( gender =="female"~"lightblue", gender =="male"~"lightsalmon1"))## Generate a pedigree from the first halftiny_pedigree(data=data1, symbolsize=1.1, fold=FALSE)
Show the code
## Assign or calculate enhancements to the second halfdata2$hilite <-TRUEdata2 <- data2 |>mutate(color =case_when( gender =="female"~"lightblue", gender =="male"~"lightsalmon1"))## Generate a pedigree from the second halftiny_pedigree(data=data2, textsize=0.6, symbolsize=1.1, fold=FALSE)
Show the code
## Join (row bind) the two halves## The first two lines of second half are not neededdata <-rbind(data1, data2[3:nrow(data2),])## Create a presentation tablegt(data) |>cols_hide(columns=c(dad, mom, gender, hilite, color)) |>tab_source_note(source_note="Source: Bridges family documents")
ID
born
died
Charles Wentworth
1648
1780
Amariah Wentworth
1719
1799
Bethiah Fenno
1692
1780
Rebecca Shepard
1723
1791
Elijah Wentworth
1775
1810
Elijah S. Estes
1814
1887
Zebiah Walker Wentworth
1810
1887
Lucy Walker
NA
NA
Lorenzo Langston Estes
1839
1909
Addie Estes
NA
NA
Charles A. Bridges
1877
NA
Charles L. Bridges
1912
2001
Mary Jane Bridges
1912
2016
Thomas Bridges
1938
NA
Kent Bridges
1941
NA
Source: Bridges family documents
4.2 Interpretive information
You can use the color coding to provide information that is not related to the demographic properties of the data.
In the following example, research progress is noted on the pedigree diagram with a color code (green means already interviewed).
Show the code
## Read the basic data (all people are listed)data <-read_csv(col_names=TRUE, show_col_types=FALSE, file="ID, dad, mom, gender, interviewed Genji, NA, NA, male, no Shizuko, NA, NA, female, yes Hiroshi, Genji, Shizuko, male, no Tamaru, Genji, Shizuko, male, yes Osamu, Genji, Shizuko, male, yes Akari, NA, NA, female, no Fumiko, Osamu, Akari, female, no Yui, NA, NA, female, yes Shota, Hiroshi, Yui, male, no Sakura, NA, NA, female, yes")## Read links for people without childrenlinks <-read_csv(col_names=TRUE, show_col_types=FALSE, file="id1, id2 Tamaru, Sakura")## Print a presenttion tablegt(data) |>sub_missing(missing_text ="") |>cols_hide(columns=c(gender)) |>tab_source_note(source_note="Source: Example data")
ID
dad
mom
interviewed
Genji
no
Shizuko
yes
Hiroshi
Genji
Shizuko
no
Tamaru
Genji
Shizuko
yes
Osamu
Genji
Shizuko
yes
Akari
no
Fumiko
Osamu
Akari
no
Yui
yes
Shota
Hiroshi
Yui
no
Sakura
yes
Source: Example data
Show the code
## Calculate and assign column propertiesdata <- data |>mutate(color =case_when( interviewed =="yes"~"lightgreen", interviewed =="no"~"gray85")) |>mutate(hilite =TRUE)## Generate and plot the pedigree structure ## You need to use the link parameter for "no-children" couplestiny_pedigree(data=data, links=links)
4.3 Family with lots of children
This is an example of the complexity when there are quite a few children. The software seems to handle this number of individuals, but it is likely close to the limit.
## Color all the symbols data$color <-"gray85"data$hilite <-TRUE## Modify the color of a specific rowdata$color[7] <-"pink"## Generate the plot the pedigreetiny_pedigree(data=data, links=links,textsize =0.7,symbolsize =0.8)
4.5 Two families combined
Show the code
## Read the datadata <-read_csv(col_names =TRUE, show_col_types=FALSE, file="ID, father, mother, sex, status Herbert Kaxxxxra, NA, NA, male, 1 Hideko Kaxxxxra, NA, NA, female, 1 Brian Kaxxxxra, Herbert Kaxxxxra, Hideko Kaxxxxra, male, 0 Nancy Kaxxxxra, NA, NA, female, 0 Candy Kaxxxxra, Herbert Kaxxxxra, Hideko Kaxxxxra, female, 0 Debbie Kaxxxxra, Herbert Kaxxxxra, Hideko Kaxxxxra, female, 0 Neil Naxxta, NA, NA, male, 0 Doreen Kaxxxxra, Herbert Kaxxxxra, Hideko Kaxxxxra, female, 0 Ayako Soxxxxbo, NA, NA, female, 1 Jinpachi Naxxxxxma, NA, NA, male, 1 Colleen Kaxxxxra, Herbert Kaxxxxra, Hideko Kaxxxxra, female, 0 Kevin Naxxxxxma, Jason Naxxxxxma, Eleanor Oyxma, male, 0 Terry Naxxxxxma, Jason Naxxxxxma, Eleanor Oyxma, male, 0 Cory Naxxxxxma, Terry Naxxxxxma, Colleen Kaxxxxra, male, 0 Karen Naxxxxxma, Terry Naxxxxxma, Colleen Kaxxxxra, female, 0 Jason Naxxxxxma, Jinpachi Naxxxxxma, Ayako Soxxxxbo, male, 1 Sachiko Naxxxxxma, Jinpachi Naxxxxxma, Ayako Soxxxxbo, female, 1 Jerry Naxxxxxma, Jinpachi Naxxxxxma, Ayako Soxxxxbo, male, 1 Eleanor Oyxma, NA, NA, female, 1 Sharon Naxxxxxma, Jason Naxxxxxma, Eleanor Oyxma, female, 0 Alyssa Dexxxon, David Dexxxon, Sharon Naxxxxxma, female, 0 Kellianne Dexxxon, David Dexxxon, Sharon Naxxxxxma, female, 0 Christopher Dexxxon, David Dexxxon, Sharon Naxxxxxma, male, 0 David Dexxxon, NA, NA, male, 0")## Links for married individuals with no childrenlinks <-read_csv(col_names=TRUE, show_col_types=FALSE, file="id1, id2 Brian Kaxxxxra, Nancy Kaxxxxra Neil Naxxta, Debbie Kaxxxxra")## Create a presentation tablegt(data) |>cols_hide(columns=c(sex, status)) |>sub_missing(missing_text ="") |>tab_source_note(source_note="Source: Kaxxxxra family data")
ID
father
mother
Herbert Kaxxxxra
Hideko Kaxxxxra
Brian Kaxxxxra
Herbert Kaxxxxra
Hideko Kaxxxxra
Nancy Kaxxxxra
Candy Kaxxxxra
Herbert Kaxxxxra
Hideko Kaxxxxra
Debbie Kaxxxxra
Herbert Kaxxxxra
Hideko Kaxxxxra
Neil Naxxta
Doreen Kaxxxxra
Herbert Kaxxxxra
Hideko Kaxxxxra
Ayako Soxxxxbo
Jinpachi Naxxxxxma
Colleen Kaxxxxra
Herbert Kaxxxxra
Hideko Kaxxxxra
Kevin Naxxxxxma
Jason Naxxxxxma
Eleanor Oyxma
Terry Naxxxxxma
Jason Naxxxxxma
Eleanor Oyxma
Cory Naxxxxxma
Terry Naxxxxxma
Colleen Kaxxxxra
Karen Naxxxxxma
Terry Naxxxxxma
Colleen Kaxxxxra
Jason Naxxxxxma
Jinpachi Naxxxxxma
Ayako Soxxxxbo
Sachiko Naxxxxxma
Jinpachi Naxxxxxma
Ayako Soxxxxbo
Jerry Naxxxxxma
Jinpachi Naxxxxxma
Ayako Soxxxxbo
Eleanor Oyxma
Sharon Naxxxxxma
Jason Naxxxxxma
Eleanor Oyxma
Alyssa Dexxxon
David Dexxxon
Sharon Naxxxxxma
Kellianne Dexxxon
David Dexxxon
Sharon Naxxxxxma
Christopher Dexxxon
David Dexxxon
Sharon Naxxxxxma
David Dexxxon
Source: Kaxxxxra family data
Show the code
## Generate and plot the pedigree diagramtiny_pedigree(data = data, links = links,symbolsize =0.8,textsize =0.6)