text_list: Takes a string of words and combines them into a sentance...

View source: R/NMFSReports.R

text_listR Documentation

Takes a string of words and combines them into a sentance that lists them.

Description

This function alows you to take a string of words and combine them into a sentance list. For example, 'apples', 'oranges', 'pears' would become 'apples, oranges, and pears'. This function uses oxford commas.

Usage

text_list(x = "", oxford = TRUE, sep = ", ", sep_last = "and ")

Arguments

x

Character strings you want in your string.

oxford

T/F: would you like to use an oxford comma? Default = TRUE

sep

string. default = ", " but "; " or " " might be what you need!

sep_last

string. default = " and " but " & " or " , " might be what you need!

Examples

text_list(c(1,2,"hello",4,"world",6))
text_list(c(1,"world"))
text_list(c(1,2,"hello",4,"world",6), oxford = FALSE)
paste0("here is a list of things: ",
  text_list(paste0("list", 1:5), sep = " ", sep_last = ""))

EmilyMarkowitz-NOAA/NMFSReports documentation built on March 26, 2023, 1:08 a.m.