Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed species_family to return latest db version #6

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mattiaghilardi
Copy link

species_family() always returns the database db_2022_09.rds stored in inst/extdata, note the columns for species and genera from the last ten years. However, the printed text refers to the latest version (now 6 February 2024).

# Old version
db <- rFishTaxa::species_family()
#> ****************************************
#> Eschmeyer's Catalog of Fishes online database show that the number of available names for use at the species level as of 6 February 2024 is 61,872, the number of valid genera is 5,251, and the number of valid species is 36,775, of which 18,688 are found in freshwater.
#> ****************************************
str(db)
#> tibble [950 × 10] (S3: tbl_df/tbl/data.frame)
#>  $ class                           : chr [1:950] "Myxini" "Myxini" "Myxini" "Myxini" ...
#>  $ order                           : chr [1:950] "Myxiniformes" "Myxiniformes" "Myxiniformes" "Myxiniformes" ...
#>  $ family                          : chr [1:950] "Myxinidae" "Myxinidae" "Myxinidae" "Myxinidae" ...
#>  $ subfamily                       : chr [1:950] NA "Rubicundinae" "Eptatretinae" "Myxininae" ...
#>  $ available_genera                : num [1:950] 19 1 10 8 19 9 2 6 1 7 ...
#>  $ valid_genera                    : num [1:950] 6 1 1 4 8 1 1 3 1 1 ...
#>  $ genera_last_ten_years_2013_2022 : num [1:950] 1 1 0 0 0 0 0 0 0 0 ...
#>  $ available_species               : num [1:950] 104 4 65 35 102 14 5 30 2 19 ...
#>  $ valid_species                   : num [1:950] 88 4 55 29 43 2 3 5 2 9 ...
#>  $ species_last_ten_years_2013_2022: num [1:950] 13 0 10 3 4 0 0 0 0 0 ...

The new code fixes this issue and returns the latest version by rearranging the html table in the same format as the stored database. I also added a new dependency, tidyr, and tidied the description file.

# New version
#devtools::install_github("mattiaghilardi/rFishTaxa", ref = "fix-species_family")
db <- rFishTaxa::species_family()
#> ****************************************
#> Eschmeyer's Catalog of Fishes online database show that the number of available names for use at the species level as of 6 February 2024 is 61,872, the number of valid genera is 5,251, and the number of valid species is 36,775, of which 18,688 are found in freshwater.
#> ****************************************
str(db)
#> tibble [950 × 10] (S3: tbl_df/tbl/data.frame)
#>  $ class                           : chr [1:950] "Myxini" "Myxini" "Myxini" "Myxini" ...
#>  $ order                           : chr [1:950] "Myxiniformes" "Myxiniformes" "Myxiniformes" "Myxiniformes" ...
#>  $ family                          : chr [1:950] "Myxinidae" "Myxinidae" "Myxinidae" "Myxinidae" ...
#>  $ subfamily                       : chr [1:950] NA "Rubicundinae" "Eptatretinae" "Myxininae" ...
#>  $ available_genera                : int [1:950] 19 1 10 8 19 9 2 6 1 7 ...
#>  $ valid_genera                    : int [1:950] 6 1 1 4 8 1 1 3 1 1 ...
#>  $ genera_last_ten_years_2015_2024 : int [1:950] 0 0 0 0 0 0 0 0 0 0 ...
#>  $ available_species               : int [1:950] 105 4 66 35 102 14 5 30 2 20 ...
#>  $ valid_species                   : int [1:950] 89 4 56 29 43 2 3 5 2 10 ...
#>  $ species_last_ten_years_2015_2024: int [1:950] 11 0 8 3 1 0 0 0 0 1 ...

Created on 2024-02-29 by the reprex package (v2.0.1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant