Skip to contents

The process_survey function processes a survey data structure, which may contain multiple vessels and catches, and converts it into a tidy tibble suitable for analysis and merging with other surveys. It handles the hierarchical nature of the data by flattening nested lists and properly aligning survey-level, vessel-level, and catch-level information.

Usage

process_survey(x)

Arguments

x

A list representing a single survey, containing survey-level data and nested vessel data.

Value

A tibble where each row represents a catch from a vessel within the survey, including survey-level data, vessel-level data, and catch-level data. The tibble includes columns vessel_number and catch_number to identify the vessel and catch within the survey.

Examples

if (FALSE) { # \dontrun{
# Assume 'single_survey' is a survey data list obtained from the API
tidy_survey <- process_survey(single_survey)
head(tidy_survey)

# To process multiple surveys stored in a list 'surveys':
all_surveys <- purrr::map_dfr(surveys, process_survey)
} # }