replace `ST` with updated version sorted by order in KST
dylanbeaudette opened this issue · 4 comments
See misc/ST_logic.rda
, thanks to Marc Olds (UCD) for this suggestion. This would have an added benefit of setting reasonable factor levels based on the "order in which taxa key out" vs. alphabetical.
One such use case: ordering in sharpshootR::SoilTaxonomyDendrogram()
based on distance matrix from ordinal vs. nominal data.
I think this would be a good time to set up the package to build all of the datasets from a data-raw folder. I don't see any issues with replacing ST with this reordered version. It does not break tests, but would be a breaking change I think warranting a bump to 0.2.0
Here is some code for validating against other datasets in the package:
library(SoilTaxonomy)
load("./misc/ST-data/ST_logic.rda")
data("ST")
x <- data.frame(
order = getTaxonAtLevel(ST$subgroup, level = 'order'),
suborder = getTaxonAtLevel(ST$subgroup, level = 'suborder'),
greatgroup = getTaxonAtLevel(ST$subgroup, level = 'greatgroup'),
subgroup = ST$subgroup,
code = taxon_to_taxon_code(ST$subgroup)
)
x <- x[order(x$code),]
head(x)
#> order suborder greatgroup subgroup code
#> lithic folistels gelisols histels folistels lithic folistels AAAA
#> glacic folistels gelisols histels folistels glacic folistels AAAB
#> typic folistels gelisols histels folistels typic folistels AAAC
#> hemic glacistels gelisols histels glacistels hemic glacistels AABA
#> sapric glacistels gelisols histels glacistels sapric glacistels AABB
#> typic glacistels gelisols histels glacistels typic glacistels AABC
all(x$subgroup == ST_logic$subgroup)
#> [1] TRUE
Good call--and I agree 100%, we have to be able to re-generate all of this from canonical sources. The only thing I wasn't sure about re-generating had to do with creating the ST
object from NASIS domains. That is where it originally came from, but required a tiny but of manual "fixing". Lets sort this out at your convenience. A lot going on right now.
Closing this as the ordering was implemented in the ST_unique_list
object, not ST