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 |
na.rm |
Logical ( |
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 |
time.limits |
Vector of two |
time.limit.rep |
Logical ( |
time.limit.offspring |
Logical ( |
time.limit.moves |
Logical ( |
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:
Reference Points (
motherRpoints
,fatherRpoints
, andoffspringRpoints
).Each point corresponds to an animal included in the 'plot_table()' function output.
For reproductive animals (mothers and fathers), a reference point is the location of their last sample within the specified time window.
For offspring, the reference point is the location of their first sample within the time window.
Movement Points (
motherMovePoints
,fatherMovePoints
, andoffspringMovePoints
).These points represent all the samples of the respective animals.
Movement Lines (
motherMoveLines
,fatherMoveLines
andoffspringMoveLines
).Movement lines connect all '...MovePoints' of a specific animal in chronological order.
Movement Polygons (
motherMovePolygons
,fatherMovePolygons
andoffspringMovePolygons
):Movement polygons represent a convex hull that encloses all the samples of an individual.
An individual must have more than two samples for this representation.
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)