ropensci / taxa

taxonomic classes for R
https://docs.ropensci.org/taxa
Other
48 stars 12 forks source link

Possible issue with defining hierarchies- error when calling hierarchy #138

Closed lindsayveazey closed 6 years ago

lindsayveazey commented 6 years ago

sessionInfo() R version 3.4.3 (2017-11-30) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale: [1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] taxa_0.2.0

loaded via a namespace (and not attached): [1] compiler_3.4.3 magrittr_1.5 assertthat_0.2.0 R6_2.2.2 tools_3.4.3 pillar_1.1.0
[7] bindrcpp_0.2 glue_1.2.0 dplyr_0.7.4 tibble_1.4.2 yaml_2.1.16 Rcpp_0.12.15
[13] jsonlite_1.5 pkgconfig_2.0.1 rlang_0.2.0 bindr_0.1

##########################################

taxaQ.txt

zachary-foster commented 6 years ago

Hello @lindsayveazey, thanks for the report!

Bug confirmed on CRAN and dev versions:

> library(taxa)
> 
> mammalia <- taxon(name = "Mammalia", rank = "class", id = 9681)
> felidae <- taxon(name = "Felidae", rank = "family", id = 9681)
> panthera <- taxon(name = "Panthera", rank = "genus", id = 146712)
> tigris <- taxon(name = "tigris", rank = "species", id = 9696)
> 
> tiger <- hierarchy(mammalia, felidae, panthera, tigris)
> 
> tiger
<Hierarchy>
  no. taxon's:  4 
Error in self$taxa[[i]]$id$id : $ operator is invalid for atomic vectors
> 
zachary-foster commented 6 years ago

Hi @lindsayveazey, I think I have it fixed. Want to install the dev version and test it out?

devtools::install_github("ropensci/taxa")

lindsayveazey commented 6 years ago

You fixed it! Works fine for me now. Bravo, looking forward to introducing this package to my class tomorrow.

zachary-foster commented 6 years ago

Great! Let me know if you find other issues