Taxonomy Coercion
as.taxonomy(x)A list, JSON string, data.* object with named elements the same as the slots in class taxonomy
Objects of class "taxonomy"
library(smart.data)
as.taxonomy(list(term = "test_term", desc = "test_description"))
#> An object of class "taxonomy"
#> Slot "term":
#> [1] "test_term"
#>
#> Slot "desc":
#> [1] "test_description"
#>
#> Slot "fields":
#> character(0)
#>
#> Slot "law":
#> {
#> cur_fields <- self$smart.rules$for_usage[["test_term"]]@fields
#> new_fields <- if (rlang::is_empty(cur_fields) || identical(cur_fields,
#> "")) {
#> NULL
#> }
#> else {
#> names(purrr::keep(attr(self$smart.rules$for_naming, "history"),
#> function(i) any(i %in% self$smart.rules$for_usage[["test_term"]]@fields)))
#> }
#> if (!rlang::is_empty(new_fields)) {
#> self$smart.rules$for_usage[["test_term"]]@fields <- new_fields
#> }
#> invisible(self)
#> }
#>
#> Slot "state":
#> [1] "pending"
#>