Takes a response
and, for each individual
, uses
splitSplines
to smooth its values for each individual
using the degrees of freedom values in df
.
Provided get.rates
is TRUE
,
both the Absolute Growth Rates (AGR) and the Relative Growth Rates (RGR)
are calculated for each smooth, either using differences or first
derivatives. A combination of the unsmoothed and smoothed
values, as well as the AGR and RGR, can be plotted for each value in
df
. Note that the arguments that modify the plots apply to all
plots that are produced. The handling of missing values is controlled
via na.x.action
and na.y.action
probeDF(data, response = "Area", xname="xDays", individuals="Snapshot.ID.Tag",
na.x.action="exclude", na.y.action = "exclude",
df, smoothing.scale = "identity", correctBoundaries = FALSE,
get.rates = TRUE, rates.method="differences",
times.factor = "Days", x = NULL, x.title = NULL,
facet.x = "Treatment.1", facet.y = "Smarthouse", labeller = NULL,
colour = "black", colour.column=NULL, colour.values=NULL, alpha = 0.1,
which.traits = c("response", "AGR", "RGR"),
which.plots = "smoothedonly",
deviations.boxplots = "none",
ggplotFuncs = NULL,
...)
A data.frame
containing individuals
,
times.factor
, facet.x
, facet.y
, xname
,
response
, and, for each df
, the smoothed
response, the AGR and the RGR. It is returned invisibly. The names of
the new data are constructed by joining elements separated by full
stops (.
). In all cases, the last element is the value of
df
. For the smoothed response, the other elements are
response
and "smooth"
; for AGR and RGR, the other elements
are the name of the smoothed response and either "AGR"
or
"RGR"
.
A data.frame
containing the data.
A character
specifying the response variable to be
supplied to smooth.spline
and that
is to be plotted on the y-axis.
A character
giving the name of the
numeric
that contains the values of the predictor
variable to be supplied to smooth.spline
.
A character
giving the name(s) of the
factor
(s) that define the subsets of the data
for which each subset corresponds to the response
values for
an individual.
A character
string that specifies the action to
be taken when values of x
are NA
. The possible
values are fail
, exclude
or omit
.
For exclude
and omit
, predictions and derivatives
will only be obtained for nonmissing values of x
.
The difference between these two codes is that for exclude
the returned
data.frame
will have as many rows as data
, the
missing values have been incorporated.
A character
string that specifies the action to
be taken when values of y
, or the response
, are
NA
. The possible values are fail
, exclude
,
omit
, allx
, trimx
, ltrimx
or
rtrimx
. For all options, except fail
, missing
values in y
will be removed before smoothing.
For exclude
and omit
, predictions
and derivatives will be obtained only for nonmissing values of
x
that do not have missing y
values. Again, the
difference between these two is that, only for exclude
will the missing values be incorporated into the
returned data.frame
. For allx
, predictions and
derivatives will be obtained for all nonmissing x
.
For trimx
, they will be obtained for all nonmissing
x
between the first and last nonmissing y
values
that have been ordered for x
; for ltrimx
and
utrimx
either the lower or upper missing y
values, respectively, are trimmed.
A numeric
specifying the set of degrees of freedom to
be probed.
A character
giving the scale on which smoothing
is to be performed. The two possibilites are "identity"
, for directly
smoothing the observed response
, and "logarithmic"
, for smoothing the
log
-transformed response
.
A logical
indicating whether the fitted
spline values are to have the method of Huang (2001) applied
to them to correct for estimation bias at the end-points. Note that
if rates.method
is set to "derivatives"
then it is not
possible to have correctBoundaries
set to TRUE
.
A logical
specifying whether or not the growth
rates (AGR and RGR) are to be computed and stored.
A character
specifying the method to use in
calculating the growth rates. The two possibilities are
"differences"
and "derivates"
.
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.
A character
giving the variable to be plotted on the
x-axis. If x
is NULL
then xname
is used.
Title for the x-axis. If NULL
then set to times.factor
.
A data.frame
giving the variable to be used to
form subsets to be plotted in separate columns of plots.
Use "."
if a split into columns is not wanted.
A data.frame
giving the variable to be used to
form subsets to be plotted in separate rows of plots.
Use "."
if a split into columns is not wanted.
A ggplot
function
for labelling the
facets of a plot produced using the ggplot
function.
For more information see ggplot
.
A character
specifying a single colour to use in
drawing the lines for the profiles. If colouring according to the
values of a variable is required then use colour.column
.
A character
giving the name of a column
in data
over whose values the colours of the lines are to be
varied. The colours can be specified using colour.values
.
A character
vector specifying the values of
the colours to use in drawing the lines for the profiles.
If this is a named vector, then the values will be matched based
on the names. If unnamed, values will be matched in order
(usually alphabetical) with the limits of the scale.
A numeric
specifying the degrees of transparency to
be used in plotting. It is a ratio in which the denominator
specifies the number of points (or line) that must be overplotted
to give a solid cover.
A character
giving the traits that are to be
produced. One of more of response
, AGR
and RGR
.
If all
, all three traits are produced. The unsmoothed growth
rates are not calculated if only smoothed plots are requested.
A character
giving the plots that are to be
produced. If none
, no plots are produced. If smoothedonly
,
plots of the smoothed traits are plotted. If bothseparatetly
,
plots of the unsmoothed trait followed by the smoothed trait are
produced for each trait. If compare
, a combined plot of the
unsmoothed trait and the smoothed trait is produced for each value
of df
.
A character
specifying whether boxplots of
the absolute
and/or relative
deviations of the values of a
trait from their smoothed values are to be produced (observed - smoothed). If none
,
no plots are produced. The argument which.traits
controls
the traits for which boxplots are produced.
A list
, each element of which contains the
results of evaluating a ggplot
function.
It is created by calling the list
function with
a ggplot
function call for each element. Note that
these functions are applied to all three plots produced.
allows passing of arguments to longiPlot
.
Chris Brien
splitSplines
, splitContGRdiff
, smooth.spline
, ggplot
.
data(exampleData)
vline <- list(ggplot2::geom_vline(xintercept=20, linetype="longdash", size=1),
ggplot2::scale_x_continuous(breaks=seq(12, 36, by=2)))
probeDF(data = longi.dat, response = "Area", df = c(4,7), x="xDays+24.16666667",
ggplotFuncs=vline)
Run the code above in your browser using DataLab