dichoKey {monographaR}R Documentation

Dichotomous key

Description

This function generates a dichotomous key

Usage

dichoKey(dat, cost = NULL, clean.characters = TRUE, cp = 0)

Arguments

dat

data.frame

cost

numeric

clean.characters

boolean

cp

numeric

Details

This is a wrapper function based on the rpart function of the rpart package. It modifies the output of rpart to a more "taxonomic" dichotomous key.

Value

list

Author(s)

Marcelo Reginato

See Also

rpart dataKey

Examples


data(monographaR_examples)

monographaR_examples$dichoKey -> dat
colnames(dat)[1] <- "species"

### Prepare matrix (polymorphic)

dataKey(dat, poly.sep = "/") -> dat.k
dat.k$dat -> dat.p

### key

dichoKey(dat.p) -> key
length(key$unresolved)

# Export

#cat(key$key, file="Pleiochiton_key.txt")

### key with costs

dat.k$summary
((dat.k$summary)+1) -> dat.c
colnames(dat.p)
dat.c[2] <- max(dat.c)
dat.c[11] <- max(dat.c)

dichoKey(dat.p, dat.c, cp=0) -> key.c
length(key.c$unresolved)

# Export

#cat(key.c$key, file="Pleiochiton_key_costs.txt")




[Package monographaR version 1.3.1 Index]