R/taxonomy.R

Defines functions taxonomy

#' Gets the higher taxonomy of the species
#'
#' @param sciname list
#'
#' @return dataframe
#' @export
#'
#' @examples
#' taxonomy("Ulva linza")
#' taxonomy(c("Ulva linza", "Mastocarpus sp.", "Corallina vancouverensis"))
#'
taxonomy <- function(sciname){
  worms_nm <- worrms::wm_records_names(sciname)
  df_authors <-  purrr::map_dfr(worms_nm,`[`) # puts everyting into a dataframe

  dplyr::mutate(df_authors,
         authorship = stringr::str_remove(authority,
                                 ", [:digit:]{4}"))
}
laijasmine/ptm documentation built on March 19, 2020, 12:07 a.m.