ropensci / rfishbase

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

list_fields() - cannot call all reported tables? #228

Closed kairos35 closed 1 year ago

kairos35 commented 3 years ago

Hi, with list_fields() one gets a data frame that lists all headers (= field names) with the respective table. Alas one can call some tables like brains() or diet(), but not for example alieninvasive(). Why is that? What is a better way to retrieve a list of callable tables? Thanks!

cboettig commented 3 years ago

Good question! Yes, the package only defines dedicated functions for 'common' tables at the moment, but you can mint your own custom functions for any table using the function factory, rfishbase:::endpoint(), like so:

alieninvasive <- rfishbase:::endpoint("alieninvasive")
alieninvasive()

(Note that the pre-built functions, like diet(), brains() etc, must also include built-in R documentation, examples and tests, which must all be written out more manually.)