Learn R Programming

paleoTS (version 0.4-4)

sub.paleoTS: Subset an evolutionary time series

Description

This function subsets a paleoTS object, returning a shorter series of specified or random samples from the original.

Usage

sub.paleoTS(y, ok = NULL, k = 0.1)

Arguments

y
a paleoTS object
ok
vector indicating which samples to retain; can be logical or numeric
k
proportion of samples to retain, chosen randomly

Value

  • the subetted paleoTS object

Details

If ok = NULL, the subsetting is done by retaining a proportion k of the initial samples, chosen at random. If ok is specified, those samples indicated will be retained.

References

Hunt, G. 2006. Fitting and comparing models of phyletic evolution: random walks and beyond. Paleobiology 32:578--601.

See Also

as.paleoTS

Examples

Run this code
y <- sim.GRW(ns=100, ms=0, vs=0.3)
 plot(y, col='grey')
 ys1<- sub.paleoTS(y, ok=y$mm > mean(y$mm))  # subsetting with logical ok
 ys2<- sub.paleoTS(y, ok=1:10)				 # subsetting with numeric ok
 ys3<- sub.paleoTS(y, k=0.1)				 # subsetting random 10%
 plot(ys1, add=TRUE, col="red")
 plot(ys2, add=TRUE, col="blue")
 plot(ys3, add=TRUE, col="green")

Run the code above in your browser using DataLab