The common constructor behind sharkKey(), arachnidaKey(),
vibrioKey() and phylotreeKey(): takes one row per lead and returns a
dimoose object.
Arguments
- leads
Data frame with columns
Statement(couplet),Choice,Character(the lead's text),Next(next couplet, or"-"if the lead ends in a result) andTaxon(the result, for terminal leads). Optional columnsLabel,Image,ImageLinkandTaxonUrlare used byexportWizard(); any others are kept.- desc
Title or description of the key.
- meta
Key/value data frame of metadata (e.g.
citation).- taxa
Data frame of results with
submitted_nameandmatched_name; by default every taxon matches itself.- features
Optional
featureTable()for keys a machine can follow (the leads then also carryFeature,TestandThreshold).
Value
A dimoose object.
Examples
leads <- data.frame(
Statement = c("1", "1", "2", "2"), Choice = c("a", "b", "a", "b"),
Character = c("Wings present", "Wings absent", "Two wings", "Four wings"),
Next = c("2", "-", "-", "-"), Taxon = c("", "Apterygota", "Diptera", "Other")
)
k <- keyFromLeads(leads, "A tiny key")
k
#> <dimoose key> A tiny key
#> 2 couplets, 4 leads, 3 taxa, up to 2 steps deep
k$toNewick()
#> [1] "((Diptera,Other)2,Apterygota)1;"