| byIndv4Times_GRsDiff {growthPheno} | R Documentation |
Adds, to a data.frame, the growth rates calculated for consecutive times
for individuals in a data.frame in long format by differencing
response values.
Description
Uses AGRdiff, PGR and
RGRdiff to calculate growth rates continuously
over time for the response by differencing pairs of pairs
of response values and
stores the results in data. The subsets are those values
with the same levels combinations of the factors listed in
individuals.
If avail.time.diffs is FALSE, the differences between
consecutive time values are calculated. For this, it is assumed that
the same first times value is present in data for all
individuals.
Usage
byIndv4Times_GRsDiff(data, responses,
individuals = "Snapshot.ID.Tag", times = "DAP",
which.rates = c("AGR","PGR","RGR"),
suffices.rates=NULL, sep.rates = ".",
avail.times.diffs = FALSE, ntimes2span = 2)
Arguments
data |
A |
responses |
A |
individuals |
A |
times |
A |
which.rates |
A |
suffices.rates |
A |
sep.rates |
A |
avail.times.diffs |
A |
ntimes2span |
A |
Value
A data.frame containing data to which has been
added i) a column for the differences between the times,
if it is not already in data, and (ii) columns with growth rates.
The name of the column for times differences will be the value
of times with ".diffs" appended. The name for each of
the growth-rate columns will be either the value of response
with one of ".AGR", ".PGR" or "RGR", or the
corresponding value from suffices.rates appended. Each growth
rate will be positioned at observation
ceiling(ntimes2span + 1) / 2 relative to the two times from
which the growth rate is calculated.
Author(s)
Chris Brien
See Also
smoothSpline, byIndv4Times_SplinesGRs
Examples
data(exampleData)
longi.dat <- byIndv4Times_GRsDiff(data = longi.dat,
response = "sPSA",
individuals = "Snapshot.ID.Tag",
times = "DAP",
which.rates=c("AGR", "RGR"),
avail.times.diffs = TRUE)