longest_most_abundant_common_suffix: Find longest and most abundant common suffix

View source: R/general_utils.R

longest_most_abundant_common_suffixR Documentation

Find longest and most abundant common suffix

Description

Find longest and most abundant common suffix

Usage

longest_most_abundant_common_suffix(
  x,
  k = 80,
  max_suffixes = 4,
  ignore.case = FALSE,
  verbose = FALSE
)

Arguments

x

A character vector

k

An integer between 1 and 99. How much more abundant should the first suffix be relative to the second most abundant suffix?

max_suffixes

An integer. If there are more than max_suffixes in x don't check for relative percentage abundance.

ignore.case

Logical. Convert all x to upper case.

verbose

Logical. Print out info.

Value

A character corresponding to the longest common suffix.

Examples

sample_names <- c("A_sample1", "B_sample1", "C_sample1", "D_sample2", "E_sample2")
longest_most_abundant_common_suffix(x = sample_names)
# Returns: "_sample1"

Ni-Ar/niar documentation built on Feb. 3, 2025, 9:25 a.m.