plotAnom

0th

Percentile

Identifies anomalous individuals and produces longitudinal plots without them and with just them

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.

Warning: anomPlot will be deprecated in future versions, its synonym plotAnom being preferred.

Keywords
hplot
Usage
plotAnom(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, ...)
Arguments
data

A data.frame containing the data to be tested and plotted.

x

A character giving the variable to be plotted on the x-axis.

response

A character specifying the response variable that is to be tested and plotted on the y-axis.

individuals

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.

breaks

A numeric vector giving the breaks to be plotted on the x-axis scale.

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.factor, 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.factor, during which testing for anomalous values is to occur. If NULL, the interval will end with the last observation.

times.factor

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.

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:

  1. data, a data frame resulting from the merge of data and the logical identifying whether or not an individual is anomalous;

  2. innerPlot, an object of class ggplot storing the longitudinal plot of the individuals that are not anomalous;

  3. 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.

See Also

anom, intervalValueCalculate, ggplot.

Aliases
  • plotAnom
  • anomPlot
Examples
# NOT RUN {
data(exampleData)
anomalous <- plotAnom(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")
# }
Documentation reproduced from package growthPheno, version 1.0-13, License: GPL (>= 2)

Community examples

Looks like there are no examples yet.