splitContGRdiff: Adds, to a 'data.frame', the growth rates for individuals...

splitContGRdiffR Documentation

Adds, to a data.frame, the growth rates for individuals calculated continuously over time 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.

Note: this function is soft deprecated and may be removed in future versions.
Use byIndv4Times_GRsDiff.

Usage

splitContGRdiff(data, responses, 
                individuals = "Snapshot.ID.Tag", INDICES = NULL,
                which.rates = c("AGR","PGR","RGR"), suffices.rates=NULL, 
                times.factor = "Days", avail.times.diffs = FALSE, 
                ntimes2span = 2)

Arguments

data

A data.frame containing the columns for which growth rates are to be calculated.

responses

A character giving the names of the columns in data for which growth rates are to be calculated.

individuals

A character giving the name(s) of the factor(s) that define the subsets of response that correspond to the response values for an individual (e.g. plant, pot, cart, plot or unit) for which growth rates are to be calculated continuously. If the columns corresponding to individuals are not factor(s) then they will be coerced to factor(s). The subsets are formed using split.

INDICES

A pseudonym for individuals.

which.rates

A character giving the growth rates that are to be calculated. It should be a combination of one or more of "AGR", "PGR" and "RGR".

times.factor

A character giving the name of the column in data containing the factor for times at which the data was collected. Its levels will be used in calculating growth rates and should be numeric values stored as characters.

avail.times.diffs

A logical indicating whether there is an appropriate column of times diffserences that can be used as the denominator in computing the growth rates. If TRUE, it will be assumed that the name of the column is the value of times with .diffs appended. If FALSE, a column, whose column name will be the value of times with .diffs appended, will be formed and saved in the result, overwriting any existing columns with the constructed name in data. It will be calculated using the values of times in data.

ntimes2span

A numeric giving the number of values in times to span in calculating growth rates by differencing. Each growth rate is calculated as the difference in the values of one of the responses for pairs of times values that are spanned by ntimes2span times values divided by the difference between this pair of times values. For ntimes2span set to 2, a growth rate is the difference between consecutive pairs of values of one of the responses divided by the difference between consecutive pairs of times values.

suffices.rates

A character giving the characters to be appended to the names of the responses to provide the names of the columns containing the calculated growth rates. The order of the suffices in suffices.rates should correspond to the order of the elements of which.rates. If NULL, the values of which.rates are used.

Value

A data.frame containing data to which has been added 9i) 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 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

fitSpline, splitSplines

Examples

data(exampleData)
longi.dat <- splitContGRdiff(data = longi.dat, 
                             response="sPSA", times.factor = "DAP", 
                             individuals = "Snapshot.ID.Tag", 
                             which.rates=c("AGR", "RGR"), 
                             avail.times.diffs = TRUE)

growthPheno documentation built on Sept. 11, 2024, 6:42 p.m.