Code
librarian::shelf(
calcofi/calcofi4r,
dplyr, DT, glue, here,
quiet = T)
source(here("../apps_dev/libs/db.R")) # con: database connection While working on + larvae into oceano app · Issue #23 · CalCOFI/apps, noticing some funkiness with species_codes and species_codes_new tables.
librarian::shelf(
calcofi/calcofi4r,
dplyr, DT, glue, here,
quiet = T)
source(here("../apps_dev/libs/db.R")) # con: database connection species_codesd_spp <- tbl(con, "species_codes") |>
collect()
dim(d_spp)[1] 1209 6
table(d_spp$taxon_rank, useNA="ifany")
Class Family Genus Infraclass Kingdom None Order
2 153 262 1 1 6 15
Phylum Species Subfamily Suborder Subphylum Subspecies
2 743 17 5 1 1
species_codes_newd_spp_new <- tbl(con, "species_codes_new") |>
collect()
dim(d_spp_new)[1] 1150 6
table(d_spp_new$taxon_rank, useNA="ifany")
Class Family Genus Infraclass Kingdom None Order
2 145 253 1 1 4 15
Phylum Species Subfamily Suborder Subphylum Subspecies <NA>
2 672 15 4 1 1 34
species_codes vs species_codes_newd_spp |>
left_join(d_spp_new, by="scientific_name") |>
filter(is.na(taxon_rank.x) | is.na(taxon_rank.y)) |>
# names() |> paste(collapse=', ') |> cat()
select(
scientific_name,
id.x, id.y,
spccode.x, spccode.y,
itis_tsn.x, itis_tsn.y,
common_name.x, common_name.y,
taxon_rank.x, taxon_rank.y) |>
datatable()is.na(taxon_rank) (n=34) in species_codes_new but not species_codes?taxon_rank == 'None'?species_codes_new since missing taxon_rank for 34 rows that are populated in species_codesspecies_codes to speciesid spccode spccode to sp_id since