traitfill: Fill missing trait values

Description Usage Arguments Details Examples

Description

Fill missing binary trait data values based on taxonomic structure.

Usage

1
traitfill(dat, nrep, with_replacement = TRUE, names = c("n0", "n1"))

Arguments

dat

A data set (see Details)

nrep

Number of simulation runs to do.

with_replacement

Do the sampling with or without replacement (default is TRUE)

names

Names for columns in dat corresponding to state 0 and state1.

Details

This is a direct port from richfitz/wood with nothing other than stylistic changes.

It assumes that the taxonomy is structured into order / family / genus. Trait data are assumed in columns called "n0" and "n1", unless alternative names are passed through in names. A column called "N" must be present that has the estimate of the number of species within the genus.

So dat must have columns:

The function returns a big list with elements:

each element is a data.frame with columns

Examples

1
2
3
4
5
6
## Data from "How much of the world is woody?"
wood <- load_wood()
## Fill in missing woodiness data; this says that the "H" column
## is state 0 and the "W" column is state 1, so that the generated
## percentages are "percentage woody" and not "percentage herbacious.
res <- traitfill(wood, 50, names=c("H", "W"))

traitecoevo/traitfill documentation built on May 31, 2019, 7:44 p.m.