-
Notifications
You must be signed in to change notification settings - Fork 42
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
Missing diet values - Data base update? #281
Comments
yup, working on preparing the new release. should be up soon |
Package plumbing still in the works, but can you try:
This directly accesses our API and should provide the current data (July 2024 release) for the sealifebase diet table. |
Thanks for the quick answer! I noticed something else though and I think this issue has been raised in the past (#87), namely the combination of information from the Table Join# pull all diet items from SeaLifeBase
diet_items <- fb_tbl(tbl = "diet_items", server = "sealifebase")
# get diet for single or list of species; here harbour porpoise
diet_species <- diet(species_list = "Phocoena phocoena", server = "sealifebase")
# join tables and select columns
diet_species_detail <- diet_species %>%
left_join(diet_items, by = "DietCode") %>%
select(Species, SampleStage, DietCode, C_Code, Locality, January, February, March, April, May, June, July, August, September, October, November, December, E_Code, FoodI, FoodII, FoodIII, ItemName, Stage, DietPercent) I think in issue #87 an attempt was made to do that, but right now that leads to the diet table displaying wrong or incomplete values in the Example# pull all diet items from FishBase
diet_items <- diet_items()
# get diet for cod
diet_species <- diet(species_list = "Gadus morhua", server = "fishbase")
# join tables
diet_species_detail <- diet_species %>%
left_join(diet_items, by = "DietCode") %>%
select(Species, SampleStage, DietCode, FoodI, FoodII, FoodIII, ItemName, Stage, DietPercent, OtherItems, PercentEmpty) %>%
filter(DietCode == 14)
# PercentEmpty and OtherItems contain low values which can neither be found
# in the detailed diet information nor in the current table version online The code chunk above brings me to my last point, namely the Really appreciate you work and thanks in advance! |
Thanks for sharing your experience and examples, I am sure this will be helpful to other users as well. At the moment I recommend using the I agree that it takes a while to get used to the idea of joining separate tables. But this approach that Hadley Wickham calls "Tidy Data", also known as "relational database design", where everything is just a table and all operations can be expressed by functions like joins, selects, and filters, is in fact incredibly powerful and incredibly general once you get used to it. Knowing that everything is a just a table and can be joined to other tables with key columns is in the end much more useful than relying on helper utilities like our old (rfishbase still needs to be pointed to the 2024 data, new release still coming soon!) |
Session Info
Hello!
I am right now trying to retrieve diet information tables for dozens of species from SeaLifeBase. However, many of these don't contain data that can be found online. I am particularly interested in the PercentEmpty column, which is returned when running the
diet()
command. Please find an example below; this is one of the cases where the mentioned column is empty, despite containing data in the online version.Code Example
The latest release is from May 2023, could it have something to do with that? And if yes, are there any updates planned in the near future?
Or is this command simply faulty when running it on SeaLifeBase? However, when running
> fb_tbl("diet", server="sealifebase")
, there are entries with values in that column.Any help would be much appreciated.
Thanks in advance!
The text was updated successfully, but these errors were encountered: