Description Usage Arguments Examples
View source: R/mermaid_clean_management_rules.R
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 NA
s by default, but this option can be changed via missing_value
.
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_
)
|
.data |
Input data |
management_rules |
Column containing management rules. Defaults to |
name |
Name of the clean column, e.g. "Management Rules". By default just replaces the column in |
remove |
Whether to remove the |
missing_value |
How to recode missing values. Defaults to a literal NA. Can change to a specific value, e.g. "Not Specified". |
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"
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.