plotIndividualTimeline: Plot a timeline of recorded data

Description Usage Arguments Author(s) Examples

View source: R/plotIndividualTimeline.R

Description

This function plots a timeline of recorded data per individual, using an obkData object. Colors can be used to display meta-information on individuals, while different types of records are indicated using different symbols.

Usage

1
2
3
 plotIndividualTimeline(x, what="", selection=NULL, ordering=NULL,
                        orderBy=NULL, colorBy=NULL, periods=NULL,
                        plotNames=length(selection)<50, ...) 

Arguments

x

the main obkData object

what

a character string indicating which type of record should be displayed; partial matching is permitted; 'dna' should be used to include dates of DNA sequence collections; several values can be provided as a vector; if left by default (""), all available data are use.

selection

a vector of integers indicating the subset of individuals to plot

ordering

a vector of the same length as selection, which specifies the order of individuals on the plot. Overridden by orderBy.

orderBy

a character indicating the name of the column that should be used to order the individuals. Overrides ordering.

colorBy

a character indicating the name of the column by which individuals should be coloured

periods

an Nx2 matrix of strings, giving pairs of column names for periods to be plotted

plotNames

a logiacal indicating whether the individualIDs should be shown at the y-axis

...

further arguments passed to geom_point.

Author(s)

Original version by Rolf Ypma, modified by Thibaut Jombart.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
## simple example using ToyOutbreak
data(ToyOutbreak)
plotIndividualTimeline(ToyOutbreak)
plotIndividualTimeline(ToyOutbreak, what="DateInfected", colorBy="Sex")
plotIndividualTimeline(ToyOutbreak, what="DateInfected", colorBy="Age",
   orderBy="Sex")

plotIndividualTimeline(ToyOutbreak,selection=1:15,orderBy='lat')
plotIndividualTimeline(ToyOutbreak,selection=1:15,orderBy='lat',
   colorBy="Sex", size=4)


## example using HorseFlu
data(HorseFlu)

## plot all information, coloring by yard - messy!
plotIndividualTimeline(HorseFlu,colorBy='yardID')

## sort on yard, only DNA sequence collection
plotIndividualTimeline(HorseFlu, what="dna", orderBy='yardID',colorBy='yardID')

## just plot the first 30, vaccination dates
plotIndividualTimeline(HorseFlu, what=c("FirstVac","LastVac"),
   selection=1:30,orderBy='yardID',colorBy='yardID', size=3)

thibautjombart/OutbreakTools documentation built on Oct. 26, 2019, 10:56 p.m.