ropensci / rfishbase

R interface to the fishbase.org database
https://docs.ropensci.org/rfishbase
109 stars 40 forks source link

Function 'brains' returns the same 17 values independent of taxon #259

Closed rtfiguer closed 1 year ago

rtfiguer commented 1 year ago

I'm currently running through an issue when running the function 'brains' from rfishbase package.

When I try exporting Encephalization Coefficient (EncCoef) data from a set of Genus names, it will return the same distribution of 17 values for any entry that I make, independent of it being a Genus on fishbase or not. I'm not sure what is going on but I don't think the issue is with my script.

For example, running:

taxa <- c("Acipenser", "Alosa", "Amia", "Apodichthys", "Carinotetraodon", "Channa", "Chlorophthalmus", "Elops", "Glyptothorax", "Gobiesox", "Lepisosteus", "Macrognathus", "Microgadus", "Oryzias", "Parazen", "Polyodon", "Serrasalmus", "Valenciennea")

br_data <- brains(taxa, server = getOptions("FISHBASE_API", "fishbase"))

It will return 306 rows, being 17 for each genus and with the same distribution of values for 'BodyWeight', 'BrainWeight' and 'EncCoef'.

I checked this running library(dplyr) aggregate(x = br_data$EncCoef,
by = list(br_data$taxa),
FUN = function(x) c(n = length(x), mean = mean(x), SD = sd(x)))

Which will return mean = 8.653761, sd = 8.145737 and length = 17 for each genus in 'taxa'.

I also tried running it for a single entry. e.g: brains("Lepisosteus", server = getOptions("FISHBASE_API", "fishbase") and the same issue persists. Even if I include a genus name that doesn't exist e.g. "Spaguetti" it will still return the same results...

Thank you in advance

cboettig commented 1 year ago

Try accessing the brains table directly, e.g.

brains()

with no arguments and filtering for the desired taxa from there.

Please note that when giving a species argument, you must provide standardized scientific names, not arbitrary taxa (genus).
Please try the current GitHub release (4.1.0), it should return no results if you give it non-standardized names.

re-open if the issue persists.