plot_table {wpeR}R Documentation

Prepares pedigree data for plotting and spatial representation

Description

Combines extended pedigree (obtained by org_fams() function) and sample metadata data for visual (ped_satplot()) and spatial (ped_spatial()) representation of the pedigree.

Usage

plot_table(
  plot_fams = "all",
  all_fams,
  ped,
  sampledata,
  datacolumns = c("Sample", "AnimalRef", "GeneticSex", "Date", "SType", "lat", "lng",
    "FirstSeen", "LastSeen", "IsDead"),
  deadSample = c("Tissue")
)

Arguments

plot_fams

Character string or numeric vector. FamID numbers from fams data generated by org_fams() function. If all families want to be plotted it is defined as character string "all". For a subset of families a numeric vector of FamIDs has to be specified. Defaults to "all".

all_fams

Data frame. Family (fams) data generated by org_fams() function.

ped

Data frame. Organized pedigree (ped) generated by org_fams() function.

sampledata

Data frame. Metadata for all genetic samples that belong to the individuals included in pedigree reconstruction analysis. For description of sampledata structure and sample information needed for plot_table() see Details.

datacolumns

Vector of column names included sampledata that are needed to produce this functions output (see Details).

deadSample

Single value or vector of different lethal sample types. Defaults to c("Tissue").

Details

Value

Extended sampledata data frame that includes all columns defined in datacolumns parameter and adds information needed for visual and spatial representation of pedigree:

Examples


# Prepare the data for usage with plot_table() function.
# Get animal timespan data using the anim_timespan() function.
animal_ts <- anim_timespan(wolf_samples$AnimalRef,
  wolf_samples$Date,
  wolf_samples$SType,
  dead = c("Tissue")
)
# Add animal timespan to the sampledata
sampledata <- merge(wolf_samples, animal_ts, by.x = "AnimalRef", by.y = "ID", all.x = TRUE)
# Define the path to the pedigree data file.
path <- paste0(system.file("extdata", package = "wpeR"), "/wpeR_samplePed")
# Retrieve the pedigree data from the get_colony function.
ped_colony <- get_colony(path, sampledata, rm_obsolete_parents = TRUE, out = "FamAgg")
# Organize families and expand pedigree data using the org_fams function.
org_tables <- org_fams(ped_colony, sampledata, output = "both")

# Run the function
# Prepare data for plotting.
plot_table(plot_fams = "all",
  org_tables$fams,
  org_tables$ped,
  sampledata,
  deadSample = c("Tissue")
)



[Package wpeR version 0.1.0 Index]