ped_spatial {wpeR}R Documentation

Get files for spatial representation of pedigree

Description

Creates georeferenced data for spatial pedigree representation form the output of plot_table() function.

Usage

ped_spatial(
  plottable,
  na.rm = TRUE,
  output = "list",
  fullsibdata = NULL,
  sibthreshold = 0,
  path = "",
  filename = "",
  out.format = "geopackage",
  time.limits = c(as.Date("1900-01-01"), as.Date("2100-01-01")),
  time.limit.rep = FALSE,
  time.limit.offspring = FALSE,
  time.limit.moves = FALSE
)

Arguments

plottable

Data frame. Output of plot_table() function.

na.rm

Logical (TRUE/FALSE). Remove samples with missing coordinates and/or dates.

output

Character vector specifying the desired output type ('list' - default or 'gis'). Available outputs: list: all spatial data returned as list, gis: all spatial data returned as georeferenced files.

fullsibdata

Data frame with COLONY full-sibling data.

sibthreshold

Numeric. P-value threshold for sibship assignment.

path

System path for storing georeferenced files.

filename

Common name for all georeferenced files.

out.format

Character string. Type of georeferenced files to be generated. Can be ether "geopackage" or "shapefile". Default is "geopackage"

time.limits

Vector of two Date values as the time window.

time.limit.rep

Logical (TRUE/FALSE). Apply time limits to reference samples of reproductive animals.

time.limit.offspring

Logical (TRUE/FALSE). Apply time limits to reference samples of offspring.

time.limit.moves

Logical (TRUE/FALSE). Apply time limits to movement data.

Details

The parameters path, filename and out.format, are used only when output parameter is set to "gis", since they control which georeferenced files should be created, where they will be saved and which common file name will they have.

Value

Depending on the output parameter the function can return a list of sf objects, a georeferenced vector data files or both.

Most of the objects are created separately for mothers, fathers and offspring, this include:

Besides that the function also produces lines that connect mothers and their offspring (maternityLines), fathers and their offspring (paternityLines), and if fullsibdata parameter is specified, full siblings (FullsibLines).

Examples

# Prepare the data for usage with ped_spatial() 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")
# Prepare data for plotting.
pt <- plot_table(plot_fams = 1,
  org_tables$fams,
  org_tables$ped,
  sampledata,
  deadSample = c("Tissue")
)

# Run the function
# Get files for spatial pedigree representation in list format.
ped_spatial(plottable = pt)



[Package wpeR version 0.1.0 Index]