R/get_common_name.R

Defines functions get_common_name

get_common_name <- function(x) {
  out <- Reduce(f = intersect, strsplit(x, split = ""))

  if(length(out)>0 && all(!is.na(out))) {
    out <- stringi::stri_c(out, collapse = "", ignore_null = TRUE)
    if(nchar(out)>0) {
      x <- out
    }
  }
  x
}

Try the saros.base package in your browser

Any scripts or data that you put into this service are public.

saros.base documentation built on June 8, 2025, 10:03 a.m.