knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

Creating new objects

The easiest way to create a tidyged object is to import an existing GEDCOM file. This functionality is provided by the tidyged.io package.

A minimal tidyged object can be created using an empty gedcom() call:

library(tidyged)

gedcom() |> 
  knitr::kable()

A tidyged object actually comes pre-populated with quite a lot of information (more so than a minimal GEDCOM file). Information about the tidyged package (as the system/product creating the file) is given in the appropriate places, as well as a default language (English), and submitter details taken from your computer username.

Submitter

You can use different information for many values using the parameters of the gedcom() function. The first argument of the function is a subm() object giving details of the submitter:

submitter <- subm(name = "The name of the submitter",
                  subm_address = address(local_address_lines = "123 Penny Lane Drive",
                                         city = "Orlando",
                                         state = "Florida",
                                         postal_code = "32836",
                                         country = "United States of America",
                                         phone_number = "123-456-789",
                                         email = "email@domain.com",
                                         fax = "00000",
                                         web_page = "http://www.whousesfaxanymore.com"),
                  subm_notes = "The information given above is dummy data")

gedcom(submitter) |> 
  knitr::kable()

Other header parameters

The remaining arguments of the gedcom() function give further information about the file and the information held within it:

gedcom(submitter_details = subm(),
       gedcom_description = "Maternal ancestors of Jamie",
       gedcom_copyright = "No copyright",
       source_data_name = "Some CD I found in the basement",
       source_data_date = date_exact(2009, 5, 12),
       source_data_copyright = "No data copyright",
       receiving_system = "tidyged",
       language = "English") |> 
  knitr::kable()

Note that:

Subsetting an existing object

You can also create a new tidyged object by subsetting an existing object. See the tidyged.utils package.

The split_gedcom() function from the tidyged.utils package subsets a tidyged object. This will retain the header and submitter information from the original object.

unique(sample555$record)

unique(tidyged.utils::split_gedcom(sample555, c("@I1@", "@I2@"))$record)

This is especially powerful when paired with the get_descendants() function (see vignette("maintenance_functions")), where you can create a separate object for an entire branch.

Next article: Referencing records >



jl5000/tidygedcom documentation built on June 22, 2022, 5:16 p.m.