format_string: Formats Text Strings For Plotting

View source: R/format_string.R

format_stringR Documentation

Formats Text Strings For Plotting

Description

Formats differently words in a set of text strings for plotting.

Usage

format_string(
  s,
  i = NULL,
  b = NULL,
  spt = "_",
  sep = " ",
  pattern = NULL,
  add_terms = NULL
)

Arguments

s

string of text.

i

vector indicating the position of words in strings to show in italics.

b

vector indicating the position of words in strings to show in bold-face.

spt

character indicating the separator between words.

sep

character indicating the output separator.

pattern

regex pattern to select words to be omitted in formatting.

add_terms

vector with words to be omitted from formatting.

Details

At the moment, the maximum length os strings admitted is 10 words. Several terms are excluded by default from formatting: "sp", "sp.", "spp", "spp.", "unclassified", "unidentified", "others".

Examples

x <- c("Fusarium_oxysporum_P1304", "Alternaria_sp._P1555", "Fusarium_oxysporum_f.sp._melonis")
format_string(x, i = 1:4, pattern = "P[0-9]", add_terms = "f.sp.")

jgmv/misctools documentation built on March 24, 2024, 12:05 p.m.