ropensci / taxlist

Handling taxonomic lists
https://docs.ropensci.org/taxlist/
12 stars 4 forks source link

Proper handle of Parent information by 'add_concept()' #35

Open kamapu opened 1 year ago

kamapu commented 1 year ago

If data frames appended by add_concept() contain information on Parent taxa, they are not properly handled yet. Check following code extracted from chunk prototype in taxlist's vignette.

# Load package
library(taxlist)

# Load data
load(file.path(path.package("taxlist"), "wetlands_syntax.rda"))

# Build taxlist
Syntax <- new("taxlist")
levels(Syntax) <- c("association", "alliance", "order", "class")

taxon_views(Syntax) <- data.frame(
  ViewID = 1, Secundum = "Alvarez (2017)",
  Author = "Alvarez M", Year = 2017,
  Title = "Classification of aquatic and semi-aquatic vegetation in East Africa",
  stringsAsFactors = FALSE
)

Syntax <- add_concept(Syntax,
  TaxonName = Concepts$TaxonName,
  AuthorName = Concepts$AuthorName,
  Parent = Concepts$Parent,
  Level = Concepts$Level,
  ViewID = rep(1, nrow(Concepts))
)

Syntax