An R6 object holding a dichotomous key as a table of the leads on every
path from the root to a terminal taxon. Usually created by
importFishbase() or parseFishbase(). See
https://www.fishbase.se/keys/allkeys.php for FishBase keys.
Active bindings
descKey title or description (read-only).
dfData frame with one row per lead (or per term, if terms were separated) per terminal taxon, with columns
Statement,Choice,Character,Taxon, andpSt/pChfor the parent lead.metaKey/value data frame of metadata (citation, image URLs, ...).
taxaData frame of terminal taxa and their resolved names.
leadsData frame with one row per lead:
Statement,Choice,Character,Next(next couplet, or"-"if terminal) andTaxon, plus optionalPrev,Image,ImageLink,TaxonUrl,Question,Feature,TestandThreshold. Derived fromdfwhen the object was created without one.featuresData frame of features a machine can compute, one per row (see
featureTable()), orNULLfor keys meant only for people.
Methods
dimoose$new()
Create a new dimoose object.
Usage
dimoose$new(df, desc = NA, meta = NA, taxa = NA, leads = NULL, features = NULL)Arguments
dfData frame of leads (see the
dffield).descKey title or description.
metaKey/value metadata data frame.
taxaData frame of terminal taxa.
leadsOptional data frame of leads (see the
leadsfield).featuresOptional data frame of machine-readable features (see
featureTable()).
dimoose$summary()
Counts describing the key and how quickly it reaches a
result (see keyQuality()).
Arguments
weightsOptional named numeric vector of how common each taxon is, as for
keyQuality(); by default all taxa count the same.
Returns
A one-row data frame: title, couplets, leads, taxa,
depth (longest path in steps), problems (see validate()),
meanLeadSteps and meanTaxonSteps (steps to a result, averaged
over terminal leads and over taxa), expectedSteps (averaged over
taxa by weights), bound (the expected steps of the best key
there could be to these taxa, with couplets no larger than this
key's largest) and efficiency (bound / expectedSteps, 1 for a
key that could not be shorter).
dimoose$validate()
Check the key: leads to missing couplets, terminal leads without a taxon, couplets with fewer than two leads, couplets that cannot be reached from the first one, and (for keys with features) leads whose machine test is missing or inconsistent.
dimoose$toDataTree()
Convert the key to a data.tree::Node: couplets are
internal nodes and taxa leaves; each child node carries the lead
label and the character text of the lead that leads to it. A
couplet reached from several leads is attached under the first.
dimoose$toNewick()
Write the key's topology in Newick format, with couplets as internal node labels and taxa as leaves (labels quoted when needed). A couplet reached from several leads is placed under the first.