updates to drat repo
- rescript personal deploy.R script
- pull request
rfishbase queries from users: getting “Resilience,” “Vulnerability” and “Price Category” data:
x <- species_info("Labroides bicolor", fields = c("SpecCode", "Vulnerability", "PriceCateg"))
It so happens that “Resilience” is not in that table, but in the “stocks” table instead:
y <- stocks("Labroides bicolor", fields=c("SpecCode", "Resilience"))
You can now merge the results:
data <- merge(x,y)
In general, you can see a list of all the columns in a given table by just omitting the “fields” argument:
Since the nearly 100 columns don’t fit in the page, the function just summarizes the column names for the ones that don’t fit. You can read through that list and spot the words “Vulnerability” and “PriceCateg”, and then use them in the ‘fields’ argument to just get those results.
Note that all of these functions can take a long list of species names instead of a single species, and thus will return a table with a row for each species and the desired columns.
Also note that we use “SpecCode”, the species code, to identify a species on fishbase. You can use the function “speciesnames” to transform this numeric code into a species name; e.g.
data$SpecCode <- speciesnames(data$SpecCode)
- Improved sql helper script recipe.
searching SQL for a field
select distinct table_name from information_schema.columns where column_name in ('Resilience') and table_schema='fbapp';
and then we can do the usual