Learn R Programming

growthPheno (version 3.1.18)

byIndv4Times_WaterUse: Adds to a data.frame, water use traits calculated for consecutive times for individuals in the data.frame in long format.

Description

Calculates, for subsets of the data, those water traits out of Water Use (WU), Water Use Rate (WUR) and Water Use Index (WUI) that are specified in which.water.traits. The traits are calculated continuously over time for the water traits using the values of the variables for consecutive times stored in data. The weight.after column and whichever of weight.before and water.added is not NULL are used in the calculations. 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 each value of individuals.

Usage

byIndv4Times_WaterUse(data, weight.after = "Weight.After",
                    weight.before = NULL, water.added = NULL, 
                    responseAGR = NULL, 
                    individuals = "Snapshot.ID.Tag", times = "DAP", 
                    which.trait.types = c("WU","WUR","WUI"), 
                    water.trait.names = c("WU", "WUR", "WUI"),  
                    avail.times.diffs = FALSE, ntimes2span = 2)

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 the water traits nominated in which.trait.types using the names specified in

water.trait.names. The name of the column for times

differences will be the value of times with ".diffs"

appended. Each water trait will be positioned at observation

ceiling(ntimes2span + 1) / 2 relative to the two times from which the growth rate is calculated.

Arguments

data

A data.frame containing the columns to be used in calculating the water traits.

weight.after

A character giving the name of the column in data that contains the values of the weight of a pot/cart after water has been added.

weight.before

A character giving the name of the column in data that contains the values of the weight of a pot/cart before water has been added.

water.added

A character giving the name of the column in data that contains the values of the volume of water that was added to a pot/cart during watering.

responseAGR

A character giving the name of the column in data that contains the values of the Absolute Growth Rate (AGR) of the plant in a a pot/cart in the intervals between successive times of watering.

individuals

A character giving the name of the factor that defines the subsets of response that correspond to the weight, volume and absolute growth rate values for an individual (e.g. plant, pot, cart, plot or unit) for which the water traits are to be calculated continuously. If the column corresponding to individuals is not a factor then it will be coerced to factor. The subsets are formed using split.

times

A character giving the name of the column in data containing the times at which the data was collected, either as a numeric, factor, or character. It will be used in calculating the water traits. If a factor or character, the values should be numerics stored as characters.

which.trait.types

A character giving the water traits that are to be calculated and stored in the data.frame data. It should be a combination of one or more of "WU", "WUR" and "WUI".

water.trait.names

A character giving the names of the columns in data for the water traits listed in which.trait.types. The length of the supplied value for water.trait.names must be at least as long as that for which.trait.types. The names will be assigned in order to the traits in which.trait.types.

avail.times.diffs

A logical indicating whether there is an appropriate column of times differences 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.

Author

Chris Brien

Details

If weight.before is not NULL, then the water use (WU) between consecutive times is calulated as value of weight.after for first time minus the weight.after for the second time. If water.added is not NULL, then the water use (WU) between consecutive times is calulated as value of the water.added minus the the difference between the weight.after values for the two consecutive times. The WUR is calculated as the WU divided by the times.diffs and the WUI is calculated as the ratio of the values on the column nomiated by responseAGR to the WUR values.

See Also

smoothSpline, byIndv4Times_GRsDiff

Examples

Run this code
data(exampleData)
longi.dat <- byIndv4Times_WaterUse(data = longi.dat, 
                                   weight.before = "Weight.Before", 
                                   individuals = "Snapshot.ID.Tag", 
                                   times = "DAP", 
                                   which.trait.types = c("WU","WUR","WUI"), 
                                   water.trait.names = c("WU", "WUR","WUI"),
                                   responseAGR = "PSA.AGR")

Run the code above in your browser using DataLab