mermaid_clean_management_rules: Clean MERMAID Management Rules

Description Usage Arguments Examples

View source: R/mermaid_clean_management_rules.R

Description

Clean up MERMAID management rules. Recodes any (or multiple of, and values are case insensitive) Period Closure, Size Limits, Gear Restrictions, and Species Restrictions to "Partial Restrictions". Other rules are converted to title case (e.g. no take to "No Take") if they aren't already. Empty strings ("") are converted to NAs by default, but this option can be changed via missing_value.

Usage

1
2
3
4
5
6
7
mermaid_clean_management_rules(
  .data,
  management_rules = management_rules,
  name = NA,
  remove = !is.na(name),
  missing_value = NA_character_
)

Arguments

.data

Input data

management_rules

Column containing management rules. Defaults to management_rules.

name

Name of the clean column, e.g. "Management Rules". By default just replaces the column in management_rules.

remove

Whether to remove the management_rules column (TRUE/FALSE). Only applicable if name is set - defaults to TRUE.

missing_value

How to recode missing values. Defaults to a literal NA. Can change to a specific value, e.g. "Not Specified".

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
library(mermaidr)
sample_events <- mermaid_search_projects(name = "Aceh Jaya Coastal Park") %>%
  mermaid_get_project_data("fishbelt", "sampleevents")

unique(sample_events[["management_rules"]])
# [1] "gear restriction; size limits; species restriction"
# [2] "open access"
# [3] "no take"

sample_events_clean <- sample_events %>%
  mermaid_clean_management_rules()

unique(sample_events_clean[["management_rules"]])
# [1] "Partial Restrictions" "Open Access"
# [3] "No Take"

data-mermaid/mermaidreporting documentation built on May 23, 2020, 7 a.m.