mfdb_dplyr {mfdb} | R Documentation |
MareFrame DB dplyr interface
Description
Use mfdb tables with dplyr
Usage
mfdb_dplyr_table(mdb, table_name, include_cols = all_cols)
mfdb_dplyr_survey_index(mdb, include_cols = all_cols)
mfdb_dplyr_division(mdb, include_cols = all_cols)
mfdb_dplyr_sample(mdb, include_cols = all_cols)
mfdb_dplyr_predator(mdb, include_cols = all_cols)
mfdb_dplyr_prey(mdb, include_cols = all_cols)
Arguments
mdb |
An object created by |
table_name |
A table name to query in |
include_cols |
Any additonal columns to include in output, see details. |
Details
Warning: Whilst these might be handy for exploration, there is no guarantee that code using these will continue to work from one version of MFDB to the next.
There is one function for each measurement table. By default every possible
taxonomy column is included. However this is somewhat inefficient if you do
not require the data, in which case specify the columns requred with
include_cols
. See mfdb::mfdb_taxonomy_tables
for possible values.
To query taxonomy tables, use mfdb_dplyr_table
, which works for any supplied table name.
See mfdb::mfdb_taxonomy_tables
for possible values for table_name.
Value
A dplyr table object, for you to do as you please.
Examples
mdb <- mfdb(tempfile(fileext = '.duckdb'))
# Include as many columns as possible
mfdb_dplyr_sample(mdb)
# Only include 'data_source' and 'species' columns, as well as measurements
mfdb_dplyr_sample(mdb, c('data_source', 'species'))
# Query the sampling_type table
mfdb_dplyr_table(mdb, 'sampling_type')
mfdb_disconnect(mdb)