Last data update: 2014.03.03

R: Subset a 'bammdata' object
subsetEventDataR Documentation

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.

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.

Author(s)

Dan Rabosky

See Also

plot.bammdata, getCohortMatrix, image

Examples

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

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(BAMMtools)
Loading required package: ape
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/BAMMtools/subsetEventData.Rd_%03d_medium.png", width=480, height=480)
> ### Name: subsetEventData
> ### Title: Subset a 'bammdata' object
> ### Aliases: subsetEventData
> ### Keywords: manip
> 
> ### ** Examples
> 
> data(whales, events.whales)
> ed <- getEventData(whales, events.whales, nsamples=500)
Processing event data from data.frame

Discarded as burnin: GENERATIONS <  0
Analyzing  500  samples from posterior

Setting recursive sequence on tree...

Done with recursive sequence

> ed2 <- subsetEventData(ed, index=1)
> plot(ed2) 
> addBAMMshifts(ed2, cex=2)
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>