Uses intervalValueCalculate
and the function
anom
to identify anomalous individuals. The user can
elect to print the anomalous individuals, a longitudinal profile plot
without the anomalous individuals and/or a longitudinal profile plot
with only the anomalous individuals. The plots are produced using
ggplot
. The plot can be facetted so that a grid of plots is
produced.
anomPlot(data, x="xDays+24.16666667", response="Area.smooth.RGR",
individuals="Snapshot.ID.Tag",
breaks=seq(12, 36, by=2), vertical.line=NULL,
groupsFactor=NULL, lower=NULL, upper=NULL,
start.time=NULL, end.time=NULL, times.factor = "Days",
suffix.interval=NULL,
columns.retained=c("Snapshot.ID.Tag", "Smarthouse", "Lane",
"Position", "Treatment.1", "Genotype.ID"),
whichPrint=c("anomalous","innerPlot","outerPlot"), na.rm=TRUE, ...)
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
longitudinal plot of the individuals that are not anomalous;
outerPlot
, an object of class ggplot
storing the
longitudinal 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.
A data.frame
containing the data to be tested
and plotted.
A character
giving the variable to be plotted on
the x-axis.
A character
specifying the response variable that
is to be tested and plotted on the y-axis.
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
value for an
individual.
A numeric
vector giving the breaks to be plotted on
the x-axis scale.
A numeric
giving position on the x-axis
at which a vertical line is to be drawn. If NULL
,
no line is drawn.
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.
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.
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.
A numeric
giving the start of the time interval,
in terms of a level of times.factor
,
during which testing for anomalous values is to occur.
If NULL
, the interval will start with the first
observation.
A numeric
giving the end of the time interval,
in terms of a level of times.factor
,
during which testing for anomalous values is to occur.
If NULL
, the interval will end with the last
observation.
A character
giving the name of the column in
data
containing the factor for times at which the data was
collected. Its levels should be numeric values stored as
characters.
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.
A character
giving the names of the
columns in data
that are to be retained in the
data.frame
of anomalous individuals.
A character
indicating what is to be printed.
If anomalous
is included, the columns.retained
are printed for the anomalous individuals.
A logical
indicating whether NA
values should
be stripped before the testing proceeds.
allows for arguments to be passed to longiPlot
.
Chris Brien
anom
, intervalValueCalculate
, ggplot
.
data(exampleData)
anomalous <- anomPlot(longi.dat, response="Area.smooth.AGR",
lower=2.5, start.time=40,
x = "xDays+35.42857143", vertical.line=29,
breaks=seq(28, 42, by=2),
whichPrint=c("innerPlot"),
y.title="Area.smooth.AGR")
Run the code above in your browser using DataLab