clean_catches: Clean SFF landings' catches table

View source: R/clean-raw-data.R

clean_catchesR Documentation

Clean SFF landings' catches table

Description

Legacy data (SFF landings) include catches information from different versions of the project. This implies that the same information (same variables) can show a different syntax and/or different column names. This function converts and recodes the information associated with species catches into the same format adopted for more recent landings.

Usage

clean_catches(x)

Arguments

x

A data frame containing raw legacy landings (SFF landings).

Value

A data frame containing species catches information in the same syntax as recent landings.

Examples

## Not run: 
authentication_details <- readLines("location_of_json_file.json")
# obtain the latest version of all files corresponding to timor-landings-v1
legacy_data <-
  cloud_object_name(
    prefix = "timor-landings-v1",
    version = "latest",
    provider = "gcs",
    options = list(
      service_account_key = authentication_details,
      bucket = "my-bucket"
    )
  )

legacy_raw <-
  readr::read_csv(file = legacy_data, col_types = readr::cols(.default = readr::col_character()))

clean_catches(legacy_raw)

## End(Not run)

WorldFishCenter/peskas.timor.data.pipeline documentation built on April 14, 2025, 1:47 p.m.