OB7-IRD / fishi

FISHeries Indicators: exploratory and descriptive processes of data associated to fisheries
https://ob7-ird.github.io/fishi
GNU General Public License v3.0
3 stars 0 forks source link
pkgdown r

fishi R package

CRAN_Status_Badge Lifecycle:
experimental R-CMD-check

FISHeries Indicators: exploratory and descriptive processes of data associated to fisheries

Overview

The fishi package is designed to facilitate fisheries and marine science research by providing a set of functions. It aims to simplify common tasks in fisheries research and to improve the efficiency and effectiveness of data analysis and interpretation in this field. It can be used with csv/excel datasets and sql queries.

This version contains a large number of indicators for running the statistical report (https://forge.ird.fr/marbec/ob7/statistical-report) and the RShiny (https://forge.ird.fr/marbec/ob7/rshiny-fishi).

Installation

You can install the fishi package directly from GitHub using the devtools package:

devtools::install_github("https://github.com/OB7-IRD/fishi",
                         INSTALL_opts=c("--no-multiarch"))

Development version

To get a bug fix or to use a feature from the development version, you can install the development version of furdeb from GitHub.

devtools::install_github("https://github.com/OB7-IRD/fishi",
                         ref = "development",
                         INSTALL_opts=c("--no-multiarch"))

Example Usage

Here is a basic example demonstrating some of the functionalities of the fishi package.

Data Loading

Load data from a CSV file:

data <- read.csv("path_to_your_file.csv")

Or load data from a SQL database with DBI:

db_connection <- DBI::dbConnect(RMySQL::MySQL(), 
                                dbname = "your_database_name", 
                                host = "your_host", 
                                user = "your_username", 
                                password = "your_password")

query <- "SELECT * FROM your_table"
data <- DBI::dbGetQuery(db_connection, query)

Or load data from a SQL database with furdeb:

db_connection <- DBI::dbConnect(RMySQL::MySQL(), 
                                dbname = "your_database_name", 
                                host = "your_host", 
                                user = "your_username", 
                                password = "your_password")

# anchors informations
ocean <- as.integer(x = 1)
country <- as.integer(x = 1)
report_year <- as.integer(2022)
vessel_type = as.integer(x = c(4, 5, 6))

activity_vessel_type <- furdeb::data_extraction(type = "database", 
                                                file_path = system.file("sql",
                                                                        "balbaya_fishing_activity_vesseltype.sql",
                                                                        package = "fishi"),
                                                database_connection = balbaya_con, 
                                                anchor = list(time_period = time_period,
                                                              country = country,
                                                              vessel_type = vessel_type,
                                                              ocean = ocean))

Vizualisation

library(fishi)
fishing_capacity(dataframe = activity_vessel_type,
                 graph_type = "plot")

Getting help

If you encounter a clear bug, please file an issue with a minimal reproducible example on GitHub issues page. This link is also available if you have any questions and improvement propositions.