traitExtractFeatures {growthPheno} | R Documentation |
Extract features, that are single-valued for each individual, from traits observed over time.
Description
Extract one or more sets of features from traits observed over time, the result being traits that have a single value for each individual. The sets of features are:
-
single times – the value for each individual for a single time. (uses
getTimesSubset
) -
growth rates for a time interval – the average growth rate (AGR and/or RGR) over a time interval for each individual. (uses
byIndv4Intvl_GRsDiff
orbyIndv4Intvl_GRsAvg
) -
water use traits for a time interval – the total water use (WU), the water use rate (WUR) and the water use index (WUI) over a time interval for each individual. (uses
byIndv4Intvl_WaterUse
) -
growth rates for the imaging period overall – the average growth rate (AGR and/or RGR) over the whole imaging period for each individual. (uses
byIndv4Intvl_GRsDiff
orbyIndv4Intvl_GRsAvg
) -
water use traits for the imaging period overall – the total water use (WU), the water use rate (WUR) and the water use index (WUI) for the whole imaging period for each individual. (uses
byIndv4Intvl_WaterUse
) -
totals for the imaging period overall – the total over the whole imaging period of a trait for each individual. (uses
byIndv4Intvl_ValueCalc
) -
maximum for the imaging period overall – the maximum value over the whole imaging period, and the time at which it occurred, for each individual. (uses
byIndv4Intvl_ValueCalc
)
The Tomato
vignette illustrates the use of traitSmooth
and
traitExtractFeatures
to carry out the SET procedure for the example
presented in Brien et al. (2020).
Use vignette("Tomato", package = "growthPheno")
to access it.
Usage
traitExtractFeatures(data, individuals = "Snapshot.ID.Tag", times = "DAP",
starts.intvl = NULL, stops.intvl = NULL,
suffices.intvl = NULL,
responses4intvl.rates = NULL,
growth.rates = NULL,
growth.rates.method = "differences",
suffices.growth.rates = NULL,
water.use4intvl.traits = NULL,
responses4water = NULL,
water.trait.types = c("WU", "WUR", "WUI"),
suffix.water.rate = "R", suffix.water.index = "I",
responses4singletimes = NULL, times.single = NULL,
responses4overall.rates = NULL,
water.use4overall.water = NULL,
responses4overall.water = NULL,
responses4overall.totals = NULL,
responses4overall.max = NULL,
intvl.overall = NULL, suffix.overall = NULL,
sep.times.intvl = "to", sep.suffix.times = ".",
sep.growth.rates = ".", sep.water.traits = "",
mergedata = NULL, ...)
Arguments
data |
A |
individuals |
A |
times |
A |
starts.intvl |
A |
stops.intvl |
A |
suffices.intvl |
A |
responses4intvl.rates |
A |
growth.rates.method |
A |
growth.rates |
A |
suffices.growth.rates |
A |
water.use4intvl.traits |
A |
responses4water |
A See the |
water.trait.types |
A |
suffix.water.rate |
A |
suffix.water.index |
A |
responses4singletimes |
A |
times.single |
A |
responses4overall.rates |
A |
water.use4overall.water |
A |
responses4overall.water |
A |
responses4overall.totals |
A |
responses4overall.max |
A |
intvl.overall |
A |
suffix.overall |
A |
sep.times.intvl |
A |
sep.suffix.times |
A |
sep.growth.rates |
A |
sep.water.traits |
A |
mergedata |
A |
... |
allows passing of arguments to other functions; not used at present. |
Value
A data.frame
that contains an individuals
column and a
column for each extracted trait, in addition to any columns in mergedata
.
The number of rows in the data.frame
will equal the number of
unique element of the individuals
column in data
, except when
there are extra values in the individuals
column in data
. If the
latter applies, then the number of rows will equal the number of unique
values in the combined individuals
columns from mergedata
and
data
.
The names of the columns produced by the function are constructed as follows:
-
single times – A name for a single-time trait is formed by appending a full stop to an element of
responses4singletimes
, followed by the value oftimes
at which the values were observed. -
growth rates for a time interval – The name for an interval growth rate is constructed by concatenating the relevant element of
responses4intvl.rates
,growth.rates
and a suffix for the time interval, each separated by a full stop. The interval suffix is formed by joining itsstarts.intvl
andstops.intvl
values, separating them by the value ofsep.times.intvl
. -
growth rates for the whole imaging period – The name for an interval growth rate is constructed by concatenating the relevant element of
responses4intvl.rates
,growth.rates
andsuffix.overall
, each separated by a full stop. -
water use traits for a time interval – Construction of the names for the three water traits begins with the value of
water.use4intvl.traits
. The rate (WUR) has eitherR
or the value ofsuffix.water.rate
added to the value ofwater.use4intvl.traits
. Similarly the index (WUI) has eitherI
or the value ofsuffix.water.index
added to it. The WUI also has the element ofresponses4water
used in calculating the WUI prefixed to its name. All three water use traits have a suffix for the interval appended to their names. This suffix is contructed by joining itsstarts.intvl
andstops.intvl
, separated by the value ofsep.times.intvl
. -
water use traits for the whole imaging period – Construction of the names for the three water traits begins with the value of
water.use4intvl.traits
. The rate (WUR) has eitherR
or the value ofsuffix.water.rate
added to the value ofwater.use4intvl.traits
. Similarly the index (WUI) has eitherI
or the value ofsuffix.water.index
added to it. The WUI also has the element ofresponses4water
used in calculating the WUI prefixed to its name. All three water use traits havesuffix.overall
appended to their names. -
the total for the whole of imaging period – The name for whole-of-imaging total is formed by combining an element of
responses4overall.totals
withsuffix.overall
, separating them by a full stop. -
maximum for the whole of imaging period – The name of the column with the maximum values will be the result of concatenating the
responses4overall.max
,"max"
andsuffix.overall
, each separated by a full stop. The name of the column with the value oftimes
at which the maximum occurred will be the result of concatenating theresponses4overall.max
,"max"
and the value oftimes
, each separated by a full stop.
The data.frame
is returned invisibly.
Author(s)
Chris Brien
References
Brien, C., Jewell, N., Garnett, T., Watts-Williams, S. J., & Berger, B. (2020). Smoothing and extraction of traits in the growth analysis of noninvasive phenotypic data. Plant Methods, 16, 36. doi:10.1186/s13007-020-00577-6.
See Also
getTimesSubset
, byIndv4Intvl_GRsAvg
,
byIndv4Intvl_GRsDiff
, byIndv4Intvl_WaterUse
,
byIndv_ValueCalc
.
Examples
#Load dat
data(tomato.dat)
#Define DAP constants
DAP.endpts <- c(18,22,27,33,39,43,51)
nDAP.endpts <- length(DAP.endpts)
DAP.starts <- DAP.endpts[-nDAP.endpts]
DAP.stops <- DAP.endpts[-1]
DAP.segs <- list(c(DAP.endpts[1]-1, 39),
c(40, DAP.endpts[nDAP.endpts]))
#Add PSA rates and smooth PSA, also producing sPSA rates
tom.dat <- byIndv4Times_SplinesGRs(data = tomato.dat,
response = "PSA", response.smoothed = "sPSA",
times = "DAP", rates.method = "differences",
smoothing.method = "log",
spline.type = "PS", lambda = 1,
smoothing.segments = DAP.segs)
#Smooth WU
tom.dat <- byIndv4Times_SplinesGRs(data = tom.dat,
response = "WU", response.smoothed = "sWU",
rates.method = "none",
times = "DAP",
smoothing.method = "direct",
spline.type = "PS", lambda = 10^(-0.5),
smoothing.segments = DAP.segs)
#Extract single-valued traits for each individual
indv.cols <- c("Snapshot.ID.Tag", "Lane", "Position", "Block", "Cart", "AMF", "Zn")
indv.dat <- subset(tom.dat, subset = DAP == DAP.endpts[1],
select = indv.cols)
indv.dat <- traitExtractFeatures(data = tom.dat,
starts.intvl = DAP.starts, stops.intvl = DAP.stops,
responses4singletimes = "sPSA",
responses4intvl.rates = "sPSA",
growth.rates = c("AGR", "RGR"),
water.use4intvl.traits = "sWU",
responses4water = "sPSA",
responses4overall.totals = "sWU",
responses4overall.max = "sPSA.AGR",
mergedata = indv.dat)