plotAnom {growthPheno} | R Documentation |
Identifies anomalous individuals and produces profile plots without them and with just them
Description
Uses byIndv4Intvl_ValueCalc
and the function
anom
to identify anomalous individuals in longitudinal
data. The user can elect to print the anomalous individuals, a
profile plot without the anomalous individuals and/or a profile plot
with only the anomalous individuals. The plots are produced using
ggplot
. The plot can be facettd so that a grid of plots is
produced.
Usage
plotAnom(data, response="sPSA",
individuals="Snapshot.ID.Tag",
times = "DAP", x = NULL,
breaks.spacing.x = -2, angle.x = 0,
vertical.line=NULL,
groupsFactor=NULL, lower=NULL, upper=NULL,
start.time=NULL, end.time=NULL,
suffix.interval=NULL,
columns.retained=c("Snapshot.ID.Tag", "Smarthouse", "Lane",
"Position", "Treatment.1", "Genotype.ID"),
whichPrint=c("anomalous","innerPlot","outerPlot"), na.rm=TRUE, ...)
Arguments
data |
A data.frame containing the data to be tested
and plotted.
|
response |
A character specifying the response variable that
is to be tested and plotted on the y-axis.
|
individuals |
A character giving the name of the
factor that defines the subsets of the data
for which each subset corresponds to the response values for
an individual (e.g. plant, pot, cart, plot or unit).
|
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 . If not a numeric , it will be
converted to a numeric and used to provide the values
to be plotted on the x-axis. If a factor or
character , the values should be numerics stored as
characters.
|
x |
A character specifying a variable, or a function of
variables, to be plotted on the x-axis. If NULL , it will be
set to the value of times , which it can be assumed will be
converted to a numeric .
|
breaks.spacing.x |
A numeric whose absolute values specifies the
distance between major breaks for the x-axis in a sequence beginning with the
minimum x value and continuing up to the maximum x value. If it is negative,
the breaks that do not have x values in data will be omitted.
Minor breaks will be at half major break value or, if these do not correspond to
x-values in data when breaks.spacing.x is negative, have
a spacing of one. Thus, when breaks.spacing.x is negative,
grid lines will only be included for x-values that occur in data .
These settings can be overwritten by supplying, in ggplotFuncs ,
a scale_x_continuous function from ggplot2 .
|
angle.x |
A numeric between 0 and 360 that gives the angle of the
x-axis text to the x-axis. It can also be set by supplying, in
ggplotFuncs , a theme function from ggplot2 .
|
vertical.line |
A numeric giving position on the x-axis
at which a vertical line is to be drawn. If NULL ,
no line is drawn.
|
groupsFactor |
A factor giving the name of a
factor that defines groups of individuals between which the
test for anomalous individuals can be varied by setting values for
one or more of lower , upper , start.time and
end.time to be NULL , a single value or a set of values whose number
equals the number of levels of groupsFactor . If NULL or
only a dingle value is supplied,
the test is the same for all individuals.
|
lower |
A numeric such that values in response below
it are considered to be anomalous. If NULL , there is no
testing for values below the lower bound.
|
upper |
A numeric such that values in response above
it are considered to be anomalous. If NULL , there is no
testing for values above the upper bound.
|
start.time |
A numeric giving the start of the time interval,
in terms of a level of times ,
during which testing for anomalous values is to occur.
If NULL , the interval will start with the first
observation.
|
end.time |
A numeric giving the end of the time interval,
in terms of a level of times ,
during which testing for anomalous values is to occur.
If NULL , the interval will end with the last
observation.
|
suffix.interval |
A character giving the suffix to be
appended to response to form the
name of the column containing the calculated values. If it is
NULL then nothing will be appended.
|
columns.retained |
A character giving the names of the
columns in data that are to be retained in the
data.frame of anomalous individuals.
|
whichPrint |
A character indicating what is to be printed.
If anomalous is included, the columns.retained
are printed for the anomalous individuals.
|
na.rm |
A logical indicating whether NA values should
be stripped before the testing proceeds.
|
... |
allows for arguments to be passed to plotLongitudinal .
|
Value
A list
with three components:
-
data
, a data frame resulting from the merge
of data
and the logical
identifying whether
or not an individual is anomalous;
-
innerPlot
, an object of class ggplot
storing the
profile plot of the individuals that are not anomalous;
-
outerPlot
, an object of class ggplot
storing the
profile plot of only the individuals that are anomalous.
The name of the column indicating anomalous individuals will be result of
concatenating the response
, anom
and, if it is not
NULL
, suffix.interval
, each separated by a full stop.
The ggplot
objects can be plotted using print
and can be
modified by adding ggplot
functions before printing. If there are
no observations to plot, NULL
will be returned for the plot.
Author(s)
Chris Brien
See Also
anom
, byIndv4Intvl_ValueCalc
, ggplot2
.
Examples
data(exampleData)
anomalous <- plotAnom(longi.dat, response="sPSA.AGR",
times = "xDAP",
lower=2.5, start.time=40,
vertical.line=29,
breaks.spacing.x = 2,
whichPrint=c("innerPlot"),
y.title="sPSA AGR")
[Package
growthPheno version 2.1.25
Index]