bin.occurrences: Bin true occurrences into geologic intervals

View source: R/bin.occurrences.R

bin.occurrencesR Documentation

Bin true occurrences into geologic intervals

Description

Given the output of sample.clade(..., returnTrue = FALSE), returns the occurrence counts in each bin (i.e., the same as sample.clade(..., returnTrue = TRUE)). This helps to trace perfect parallels between both output formats of sample.clade.

Usage

bin.occurrences(fossils, bins)

Arguments

fossils

A data.frame exactly as returned by sample.clade(..., returnTrue = FALSE). See ?sample.clade) for details.

bins

A vector of time intervals corresponding to geological time ranges.

Details

This function helps a user bin "true occurrences" directly into binned occurrences, allowing for comparisons among "perfectly known" fossil records and records that have a certain resolution (given by the bins parameter).

Value

A data.frame exactly as returned by sample.clade(..., returnTrue = TRUE). See ?sample.clade) for details.

Author(s)

Matheus Januario.

Examples


###
# set seed
set.seed(1) 

# run a birth-death simulation
sim <- bd.sim(n0 = 1, lambda = 0.1, mu = 0.05, tMax = 50)

# choose bins
bins <- seq(0, 50, by = 1)

# generate "true" fossil occurrences
fossils_true <- sample.clade(sim, rho = 1, tMax = 50, returnTrue = TRUE)

# bin the true occurrences
fossils_binned <- bin.occurrences(fossils_true, bins)

# compare
fossils_true
fossils_binned


brpetrucci/PaleoBuddy documentation built on Feb. 28, 2025, 3:53 p.m.