Learn R Programming

BAMMtools (version 2.1.0)

subsetEventData: Subset a bammdata object

Description

Subsets a bammdata object. Returns a bammdata object after extracting a specified set of samples from the posterior.

Usage

subsetEventData(ephy, index)

Arguments

ephy
an object of class bammdata
index
A vector of integers corresponding to samples to be extracted from the posterior distribution of shift configurations included in the bammdata object.

Value

  • A bammdata object, but only containing index samples from the posterior in the original object.

Details

This will result in an error if you attempt to access samples that do not exist in the ephy data object. For example, if your bammdata object includes 100 samples from a posterior distribution sampled with BAMM, you can only attempt to subset with index values 1:100.

Examples

Run this code
data(whales, events.whales)
ed <- getEventData(whales, events.whales, nsamples=500)
ed2 <- subsetEventData(ed, index=1)
plot.bammdata(ed2) 
addBAMMshifts(ed2, cex=2)

Run the code above in your browser using DataLab