This package enables automated processing of fisheries data intosuitable forms for running ecosystem models against it, e.g. GADGET.
This package contains several distinct sets of functions:
mfdb function)mfdb_import_*functions)mfdb_*functions)gadget_* functions)Using this, you can install PostgreSQL locally and have a scriptautomating the process of:
Also, this libary can be used to connect to a remote database andgenerate model files from that data.
This work is based on it’s predecessor,DST^2.
Besides R, you will also need RPostgres set up to access thedatabase, and PostgreSQL installed if you want to run the databaselocally too.
Installation of RPostgres will happen automatically, however you needsome PostgreSQL libraries before it will work:
apt-get install libpq-devAlso, you can install thepostgresql package using:
apt-get install postgresqlSome additional instructions are available here:https://wiki.debian.org/PostgreSql
Now, create anmf database that the user on yourcomputer owns:
$ echo $USER # Check to see who you are, I'm lentinjlentinj$ su# su - postgres$ psqlpostgres=# CREATE USER lentinj;postgres=# CREATE DATABASE mf OWNER lentinj;Installation of RPostgres will happen automatically, however you needsome PostgreSQL libraries before it will work:
yum install postgresql-develAlso, you can install thepostgresql package using:
yum install postgresql-serverSome additional instructions are available here:https://fedoraproject.org/wiki/PostgreSQL and some tips whentroubleshooting CentOS installations can be found at:http://stackoverflow.com/questions/17633422/psql-fatal-database-user-does-not-exist
Now, create anmf database that the user on yourcomputer owns:
$ echo $USER # Check to see who you are, I'm lentinjlentinj$ su# su - postgres$ psqlpostgres=# CREATE USER lentinjpostgres=# CREATE DATABASE mf OWNER lentinj;To install PostgreSQL, download version 9.5 of the database installerfrom here:
https://www.enterprisedb.com/downloads/postgres-postgresql-downloads
Find the psql shell (SQL shell) in the start menu, and create both anmf database and user:
postgres=# CREATE USER mf PASSWORD 'mf';postgres=# CREATE DATABASE mf OWNER mf;Install using http://postgresapp.com/
Create a database calledmf.
You can install from CRAN:
install.packages('mfdb')Or useremotes to installthis directly:
# install.packages("remotes")remotes::install_github("gadget-framework/mfdb")For an introduction to the package, read thepackage?mfdb help file in R.This is also availableonline.
There are a selection of example scripts in thedemo/folder. Theexample-* scripts show the full process ofimporting data from specified sources into the database, then queryingthis to aggregate into various gadget model files. Theinttest-* scripts demonstrate other aspects, and alsofunction as tests to ensure that the library works correctly (thus theok() function calls).
Finally, there isdocumentation onthe database schema.
Given the database is setup as above, integration tests and allpackage examples can be run withmake inttest.
To run all tests (unit tests, integration, examples andcheck-as-cran), usemake.
This project has received funding from the European Union’s SeventhFramework Programme for research, technological development anddemonstration under grant agreement no.613571.