| Title: | Read and Process Data from European Seabirds At Sea |
|---|---|
| Description: | Read and process data from European Seabirds At Sea ('ESAS'). |
| Authors: | Pieter Huybrechts [aut, cre] (ORCID: <https://orcid.org/0000-0002-6658-6062>, affiliation: Research Institute for Nature and Forest (INBO)), Nicolas Vanermen [aut] (ORCID: <https://orcid.org/0000-0003-0156-357X>, affiliation: Research Institute for Nature and Forest (INBO)), Robin Daelemans [ctb] (ORCID: <https://orcid.org/0000-0003-0887-3140>, affiliation: Research Institute for Nature and Forest (INBO)), Peter Desmet [ctb] (ORCID: <https://orcid.org/0000-0002-8442-8025>, affiliation: Research Institute for Nature and Forest (INBO)), Research Institute for Nature and Forest (INBO) [cph] (ROR: <https://ror.org/00j54wy13>), European Union [fnd] (https://doi.org/10.3030/101112823) |
| Maintainer: | Pieter Huybrechts <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.0.0.9000 |
| Built: | 2026-10-09 10:26:48 UTC |
| Source: | https://github.com/inbo/esas |
This function calculates detection probabilities for specified species from ship-based survey data using distance sampling methods. It filters the input data for relevant observations, fits half-normal and hazard-rate models, and selects the best model based on AIC values. The output is a data frame containing species names, the selected model function, and the average detection probability.
Calculate_Detection_P_Ship_Based_Surveys( esas_table_2_analyse, species_2_analyse )Calculate_Detection_P_Ship_Based_Surveys( esas_table_2_analyse, species_2_analyse )
esas_table_2_analyse |
A data frame containing survey data with columns
for distance bins, platform class, transect type, observation distance,
species code, behavior, and count. As returned by |
species_2_analyse |
A vector of species codes as encoded in the species column of the Observations table in the ESAS Data Model. See the Species page of the Data Model. |
A data.frame with the following columns:
Species: The species code.
Function: The selected detection function ("HR" for hazard-rate or "HN" for half-normal).
Detection_P_AVG: The average detection probability for the species.
Other analysis functions:
Create_ESAS_Table(),
Create_Seabird_Density_Cross_Table()
# Read 4 ESAS tables: path_to_read <- system.file("extdata", "ESAS_0827343782", package = "esas") esas_tables_list <- Read_ESAS_Tables( path = path_to_read, file_encoding = "UTF-8" ) # Create an ESAS master-table: esas_table <- Create_ESAS_Table(esas_tables_list = esas_tables_list) # Execute distance analysis on selection of species: Calculate_Detection_P_Ship_Based_Surveys( esas_table_2_analyse = esas_table, species_2_analyse = c(720, 6020) )# Read 4 ESAS tables: path_to_read <- system.file("extdata", "ESAS_0827343782", package = "esas") esas_tables_list <- Read_ESAS_Tables( path = path_to_read, file_encoding = "UTF-8" ) # Create an ESAS master-table: esas_table <- Create_ESAS_Table(esas_tables_list = esas_tables_list) # Execute distance analysis on selection of species: Calculate_Detection_P_Ship_Based_Surveys( esas_table_2_analyse = esas_table, species_2_analyse = c(720, 6020) )
The Analysis functions in this R package expect a single data.frame as input. This function combines the tables from the ESAS Data Model into a single data.frame. It performs left joins to ensure that all records from the CAMPAIGNS, SAMPLES, POSITIONS, and OBSERVATIONS tables are included. It also renames the Notes columns from the CAMPAIGNS and SAMPLES tables to avoid naming conflicts.
Create_ESAS_Table(esas_tables_list)Create_ESAS_Table(esas_tables_list)
esas_tables_list |
A list containing the ESAS tables as data.frames. The list should include the following named elements: CAMPAIGNS, SAMPLES, POSITIONS, and OBSERVATIONS. |
A single data.frame that combines the information from the CAMPAIGNS, SAMPLES, POSITIONS, and OBSERVATIONS tables.
Other analysis functions:
Calculate_Detection_P_Ship_Based_Surveys(),
Create_Seabird_Density_Cross_Table()
# Read 4 ESAS tables: path_to_read <- system.file("extdata", "ESAS_0827343782", package = "esas") esas_tables_list <- Read_ESAS_Tables( path = path_to_read, file_encoding = "UTF-8" ) # Create an ESAS master-table: esas_table <- Create_ESAS_Table(esas_tables_list = esas_tables_list) esas_table# Read 4 ESAS tables: path_to_read <- system.file("extdata", "ESAS_0827343782", package = "esas") esas_tables_list <- Read_ESAS_Tables( path = path_to_read, file_encoding = "UTF-8" ) # Create an ESAS master-table: esas_table <- Create_ESAS_Table(esas_tables_list = esas_tables_list) esas_table
This function processes seabird observation data to create a cross-table of distance-corrected bird densities for selected species. It filters the data based on specific criteria, applies detection probability corrections, and calculates densities per unit area. The resulting table includes relevant metadata such as date, time, area, and location.
Create_Seabird_Density_Cross_Table( esas_table, probabilities, species_selection )Create_Seabird_Density_Cross_Table( esas_table, probabilities, species_selection )
esas_table |
A data frame containing seabird observation data as
resulting from the |
probabilities |
A data frame containing detection probabilities for
different species as returned by
|
species_selection |
A vector of species codes to include in the analysis as encoded in the species column of the Observations table in the ESAS Data Model. See the Species page of the Data Model. |
Requirements:
DistanceBins must be 0|50|100|200|300
PlatformClass must be 30 (ship-based surveys)
Area must be greater than 0
ObservationDistance must be F for flying birds and A, B, C, or D for swimming/diving birds
Transect must be True
Behaviour must not be 99
Species codes must be provided in species_selection and must exist in the esas_table
A data frame containing distance-corrected bird densities for the selected species.
Other analysis functions:
Calculate_Detection_P_Ship_Based_Surveys(),
Create_ESAS_Table()
path_to_read <- system.file("extdata", "ESAS_0827343782", package = "esas") esas_table <- Create_ESAS_Table(Read_ESAS_Tables(path = path_to_read)) Create_Seabird_Density_Cross_Table( esas_table = esas_table, probabilities = Calculate_Detection_P_Ship_Based_Surveys(esas_table, species_2_analyse = c(720,6000)), species_selection = c(720, 6020) )path_to_read <- system.file("extdata", "ESAS_0827343782", package = "esas") esas_table <- Create_ESAS_Table(Read_ESAS_Tables(path = path_to_read)) Create_Seabird_Density_Cross_Table( esas_table = esas_table, probabilities = Calculate_Detection_P_Ship_Based_Surveys(esas_table, species_2_analyse = c(720,6000)), species_selection = c(720, 6020) )
This function exports a data frame to a tab-delimited file without row names, column names, or quotes, using the specified file encoding.
Export_ESAS_Upload_Matrix(table, path, filename)Export_ESAS_Upload_Matrix(table, path, filename)
table |
A data frame or matrix to be exported as returned by
|
path |
Directory path where the file will be saved. |
filename |
Character string specifying the name of the output file without the extension. |
(invisible) The path to the exported file.
Other upload functions:
Transform_ESAS_Tables_4_Upload()
#Read 4 ESAS tables: data_path <- system.file("extdata", "ESAS_INBO_202401", package = "esas") esas_tables_list <- Read_ESAS_Tables(path = data_path, file_encoding = "UTF-8") #Convert tables to upload format: esas_4_upload <- Transform_ESAS_Tables_4_Upload(campaigns_tbl = esas_tables_list$CAMPAIGNS, samples_tbl = esas_tables_list$SAMPLES, positions_tbl = esas_tables_list$POSITIONS, observations_tbl = esas_tables_list$OBSERVATIONS, data_provider = "202", country = "BE") ## Not run: #Export upload table: Export_ESAS_Upload_Matrix(table = esas_4_upload, path = tempdir(), filename = "esas_4_upload") ## End(Not run)#Read 4 ESAS tables: data_path <- system.file("extdata", "ESAS_INBO_202401", package = "esas") esas_tables_list <- Read_ESAS_Tables(path = data_path, file_encoding = "UTF-8") #Convert tables to upload format: esas_4_upload <- Transform_ESAS_Tables_4_Upload(campaigns_tbl = esas_tables_list$CAMPAIGNS, samples_tbl = esas_tables_list$SAMPLES, positions_tbl = esas_tables_list$POSITIONS, observations_tbl = esas_tables_list$OBSERVATIONS, data_provider = "202", country = "BE") ## Not run: #Export upload table: Export_ESAS_Upload_Matrix(table = esas_4_upload, path = tempdir(), filename = "esas_4_upload") ## End(Not run)
Read 4 csv files (CAMPAIGNS, SAMPLES, POSITIONS, OBSERVATIONS) and combine them into a list of data.frames.
Read_ESAS_Tables(path, file_encoding = "UTF-8")Read_ESAS_Tables(path, file_encoding = "UTF-8")
path |
(Character.) Path to the directory containing 4 csv files as returned by the ESAS Data inventory. It should contain the files: "Campaigns.csv", "Samples.csv", "Positions.csv" and "Observations.csv". |
file_encoding |
(Character.) File encoding. Default is "UTF-8". |
A list of 4 data.frames: CAMPAIGNS, SAMPLES, POSITIONS, OBSERVATIONS.
data_path <- system.file("extdata", "ESAS_0827343782", package = "esas") Read_ESAS_Tables(data_path)data_path <- system.file("extdata", "ESAS_0827343782", package = "esas") Read_ESAS_Tables(data_path)
The resulting data.frame has 18 columns, where the first column is "RecordType" which indicates the type of record (FI, EC, ES, EP, EO). The remaining columns are filled with the respective data from the input tables.
Transform_ESAS_Tables_4_Upload( campaigns_tbl, samples_tbl, positions_tbl, observations_tbl, data_provider, country )Transform_ESAS_Tables_4_Upload( campaigns_tbl, samples_tbl, positions_tbl, observations_tbl, data_provider, country )
campaigns_tbl |
(data.frame) of campaigns table as returned by
|
samples_tbl |
(data.frame) of samples table as returned by
|
positions_tbl |
(data.frame) of positions table as returned by
|
observations_tbl |
(data.frame) of observations table as returned by
|
data_provider |
(integer) code of the data provider as described by the ESAS Data Model file information table. |
country |
(character) ISO_3166 country code of the data provider. For example: "BE". |
(data.frame) with 18 columns and a number of rows equal to the sum of rows of the input tables plus one (for the file information row).
Other upload functions:
Export_ESAS_Upload_Matrix()
## Not run: ESAS_TABLES_LIST <- Read_ESAS_Tables( path = "local_folder_with_downloaded_files", file_encoding = "UTF-8" ) Transform_ESAS_Tables_4_Upload( campaigns_tbl = ESAS_TABLES_LIST$CAMPAIGNS, samples_tbl = ESAS_TABLES_LIST$SAMPLES, positions_tbl = ESAS_TABLES_LIST$POSITIONS, observations_tbl = ESAS_TABLES_LIST$OBSERVATIONS, data_provider = "202", country = "BE" ) ## End(Not run)## Not run: ESAS_TABLES_LIST <- Read_ESAS_Tables( path = "local_folder_with_downloaded_files", file_encoding = "UTF-8" ) Transform_ESAS_Tables_4_Upload( campaigns_tbl = ESAS_TABLES_LIST$CAMPAIGNS, samples_tbl = ESAS_TABLES_LIST$SAMPLES, positions_tbl = ESAS_TABLES_LIST$POSITIONS, observations_tbl = ESAS_TABLES_LIST$OBSERVATIONS, data_provider = "202", country = "BE" ) ## End(Not run)