suffix_match: Suffix a strings where a vector exactly matches one specific...

View source: R/suffix_match.R

suffix_matchR Documentation

Suffix a strings where a vector exactly matches one specific string.

Description

Suffix a strings where a vector exactly matches one specific string.

Usage

suffix_match(string, to_match, .match, suffix)

Arguments

string

A vector of strings to suffix.

to_match

A vector of strings to match with .match.

.match

A string to match the vector to_match with.

suffix

A suffix to add at the end of each element of string.

Value

A modified version of x.

Examples

suffix_match(
  string = c("one", "banana"),
  to_match = c("number", "fruit"),
  .match = "number",
  suffix = "_num"
)

suffix_match(
  string = c("tag1", "tag2"),
  to_match = c("dead", "not-dead"),
  .match = "dead",
  suffix = ".d"
)

vft <- data.frame(
  Tag = c("01", "02"),
  Status = c("dead", "alive"),
  stringsAsFactors = FALSE
)
transform(vft, tagged = suffix_match(Tag, Status, "dead", ".d"))

fgeo.plot documentation built on Sept. 4, 2022, 1:06 a.m.