Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

should pathways_cbd() be a function? #134

Open
PietrH opened this issue Jul 8, 2024 · 2 comments
Open

should pathways_cbd() be a function? #134

PietrH opened this issue Jul 8, 2024 · 2 comments

Comments

@PietrH
Copy link
Member

PietrH commented Jul 8, 2024

Currently pathways_cbd() is a function that accepts no arguments, and always returns the same tibble. Woudn't it be better to include this tibble as a data object?

https://usethis.r-lib.org/reference/use_data.html

trias/R/pathways_cbd.R

Lines 1 to 77 in 98ef3f2

#' Pathways of introdcution as defined by CBD
#'
#' Function to get all CBD pathays of introdution at level 1 (`pathway_level1`)
#' and level 2 (`pathway_level2`). Added pathway `unknown` at level 1 and level
#' 2 for classifying taxa without pathway (at level 1 or level 2) information.
#'
#' @return A tibble data.frame with 2 columns: `pathway_level1` and
#' `pathway_level2`.
#' @export
#' @usage pathways_cbd()
pathways_cbd <- function() pathwayscbd
pathwayscbd <- dplyr::tibble(
pathway_level1 = c(
rep("release", 9),
rep("escape", 13),
rep("contaminant", 11),
rep("stowaway", 12),
rep("corridor", 3),
rep("unaided", 2),
"unknown"
),
pathway_level2 = c(
"biological_control",
"erosion_control",
"fishery",
"hunting",
"landscape_improvement",
"conservation",
"use",
"other",
"unknown",
"agriculture",
"aquaculture",
"zoo",
"pet",
"farm",
"forestry",
"fur_farm",
"horticulture",
"ornamental",
"research",
"food_bait",
"other",
"unknown",
"nursery",
"bait",
"food",
"on_animals",
"animal_parasite",
"on_plants",
"plant_parasite",
"seed",
"timber",
"habitat_material",
"unknown",
"fishing_equipment",
"container",
"airplane",
"ship",
"machinery",
"people_luggage",
"organic_packing",
"ballast_water",
"hull_fouling",
"vehicles",
"other",
"unknown",
"water",
"land",
"unknown",
"natural_dispersal",
"unknown",
"unknown"
)
)

@PietrH PietrH changed the title should pathways_cbd be a function? should pathways_cbd() be a function? Jul 8, 2024
damianooldoni added a commit that referenced this issue Jul 17, 2024
@damianooldoni
Copy link
Collaborator

You are right. I was in that time following rgbif's maintainer, Scott Chamberlain, which was using something similar. But you are right.

@PietrH
Copy link
Member Author

PietrH commented Aug 1, 2024

Scott might have a good reason, I'd be interested to know the advantages of doing it this way.

Can we link this issue to a branch or PR? That way we don't lose track.

pathways_cbd perhaps?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants