Movatterモバイル変換


[0]ホーム

URL:


MFDB: Datamanagement for fisheries model creation

CRAN version badgeCRAN ChecksCRAN RStudio mirror total downloads badgeCRAN RStudio mirror monthly downloads badgeR-CMD-check

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:

Using this, you can install PostgreSQL locally and have a scriptautomating the process of:

  1. Importing data from your sources
  2. Uploading into your local MFDB database
  3. Sampling / grouping this data
  4. Producing set of GADGET model files ready to be run by GADGET

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.

Prerequisites

Besides R, you will also need RPostgres set up to access thedatabase, and PostgreSQL installed if you want to run the databaselocally too.

Linux (Debian / Ubuntu)

Installation of RPostgres will happen automatically, however you needsome PostgreSQL libraries before it will work:

apt-get install libpq-dev

Also, you can install thepostgresql package using:

apt-get install postgresql

Some 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;

Linux (Redhat / Fedora)

Installation of RPostgres will happen automatically, however you needsome PostgreSQL libraries before it will work:

yum install postgresql-devel

Also, you can install thepostgresql package using:

yum install postgresql-server

Some 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;

Microsoft Windows

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;

Apple OS X

Install using http://postgresapp.com/

Create a database calledmf.

Installing

You can install from CRAN:

install.packages('mfdb')

Or useremotes to installthis directly:

# install.packages("remotes")remotes::install_github("gadget-framework/mfdb")

Using

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.

Development

Running integration tests

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.

Models using MFDB

Acknowledgements

This project has received funding from the European Union’s SeventhFramework Programme for research, technological development anddemonstration under grant agreement no.613571.


[8]ページ先頭

©2009-2025 Movatter.jp