Returns the support table that backfillColonySnapshots
reports for the same dates, without the gene drop, so the counts are there
in a moment and a start year can be chosen knowingly before minutes of
analysis are spent (issue #170). The Genetic-Health Trends tab shows this
same table before its "Build earlier snapshots" button is used.
previewBackfillSupport(
ped,
dates = NULL,
from = NULL,
to = NULL,
by = "year",
minAnimals = 2L
)A data.frame with one row for each date, in date order, and the
columns of the support table of backfillColonySnapshots:
snapshotDate, nLiving (the animals counted),
nPlacedByOffspring (of those, the ones with no birth date),
nPossiblyAlive (animals with no birth date that are not counted and
had not left), pctSireKnown and pctDamKnown (the percentage of
the living animals whose sire or dam is recorded, that is neither blank nor
a generated stand-in; NA when nobody was alive).
A quality-controlled pedigree data.frame (see
qcStudbook) holding at least id, sire,
dam, sex, gen, birth and exit (the last
two as Date columns), and a status column when the studbook
has one. Pass the full pedigree, not one already trimmed to a focal list of
animals.
The dates to count: Date values or ISO-8601
(YYYY-MM-DD) strings, at least one, with no missing or duplicated value.
Leave it out (NULL) to use the series described by from,
to and by; it cannot be combined with them.
The first date of the series: a Date or an ISO-8601
string. The default is the first 1 January with at least minAnimals
living animals.
The last date of the series, as from. The default is the
last 1 January on or before the latest birth or exit date in ped.
The step of the series: a string for seq.Date,
such as "year" (the default), "6 months" or "quarter".
Single whole number, at least 2: the fewest living animals a 1 January needs to start the default series. Default 2.
The dates are laid out exactly as backfillColonySnapshots lays them
out: give dates, or leave it out for a series of by steps (one
year by default) from from to to. Unless you give them, the
series starts at the first 1 January with at least minAnimals living
animals and ends at the last 1 January on or before the latest birth or exit
date in the pedigree. minAnimals only moves that default start: a
date you name, in dates or as from, is never refused for
having few animals.
An animal is counted on a date by the rules of
backfillColonySnapshots: alive from its birth date, or, with
no birth date, from the birth of its first offspring that has a date, until
its exit date; an animal with no exit date counts only when the studbook
lists it as living. No threshold refuses a date; read the counts beside the
trend.
backfillColonySnapshots
ped <- nprcgenekeepr::qcPed
previewBackfillSupport(ped,
dates = as.Date(c("2005-01-01", "2010-01-01"))
)
## the default series, and a later start when the early years rest on little
head(previewBackfillSupport(ped), 3L)
head(previewBackfillSupport(ped, minAnimals = 30L), 3L)
Run the code above in your browser using DataLab