sim: Details, generics, and methods for the 'sim' class

simR Documentation

Details, generics, and methods for the sim class

Description

The sim class is a frequent return and input argument for functions in paleobuddy. It contains the following four elements.

TE

Vector of extinction times, with NA as the time of extinction for extant species.

TS

Vector of speciation times, with tMax as the time of speciation for species that started the simulation.

PAR

Vector of parents. Species that started the simulation have NA, while species that were generated during the simulation have their parent's number. Species are numbered as they are born.

EXTANT

Vector of logicals representing whether each species is extant.

Here we declare useful generics and methods for sim objects.

Usage

is.sim(sim)

## S3 method for class 'sim'
print(x, ...)

## S3 method for class 'sim'
head(x, ...)

## S3 method for class 'sim'
tail(x, ...)

## S3 method for class 'sim'
summary(object, ...)

## S3 method for class 'sim'
plot(x, ...)

sim.counts(sim, t)

Arguments

sim, x, object

Object of class "sim"

...

Further arguments inherited from generics.

t

Time t (in Mya). Used for counting and/or plotting births, deaths and species number.

Details

is.sim A sim object must contain 4 members (usually vectors for extinction times, speciation times, species' parents and status), and all of these must have the correct length (i.e. same as all the others) and types. We do not utilize the members' order inside sim for our tests, since they are accessed with the $ operator and therefore the order is irrelevant.

print.sim The printing of a sim object is formatted into a more straightforward and informative sequence manner. We provide details only for the first few species, since otherwise this print could be overwhelming for simulations with 10+ species.

head.sim Selects only a number of species from the beginning of a sim object.

tail.sim Selects only a number of species from the end of a sim object.

summary.sim Quantitative details on the sim object. Prints the number of species, number of extant species, summary of durations and speciation waiting times, in case there are more than one species.

plot.sim Plots births, deaths, and diversity through time for the sim object.

sim.counts Calculates the births, deaths, and diversity for a sim at time t.


brpetrucci/paleobuddy documentation built on July 26, 2023, 8:15 p.m.