Learn R Programming

BioGeoBEARS (version 0.2.1)

symbolic_cell_to_relprob_cell: Convert symbolic cell (a text equation) to relprob matrix (a numeric value).

Description

This is a utility function for symbolic_to_P_matrix and symbolic_to_Q_matrix.

Usage

symbolic_cell_to_relprob_cell(charcell, cellsplit = "", mergesym = "*", d = 0.1, e = 0.01, ...)

Arguments

charcell
The text formula.
cellsplit
The symbol to split the formulas on. Default "\\+" (plus symbol, with escape code).
mergesym
The symbol to merge the formulas with. Default "+".
d
The dispersal/range expansion rate. Default d=0.1.
e
The extinction/range contraction rate. Default e=0.01.
...
Additional arguments to pass to strsplit.

Value

cellval The output cell value.

Details

This function can be used in sapply. It still will not be very fast compared to the calculations in cladoRcpp, but can be useful for demonstrative purposes.

References

http://phylo.wikidot.com/matzke-2013-international-biogeography-society-poster

Matzke_2012_IBS

See Also

symbolic_to_P_matrix

Examples

Run this code
testval=1

charcell = "1*d+1*d"

# Right
cellval = symbolic_cell_to_relprob_cell(charcell, cellsplit="yadda",
mergesym="", d=0.1, e=0.01)
cellval

# Wrong
cellval = symbolic_cell_to_relprob_cell(charcell, cellsplit="\\+",
mergesym="*", d=0.1, e=0.01)
cellval

# Right
cellval = symbolic_cell_to_relprob_cell(charcell, cellsplit="\\+",
mergesym="+", d=0.1, e=0.01)
cellval

Run the code above in your browser using DataLab