R/NMFSReports.R
text_list.Rd
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.
text_list(x = "", oxford = TRUE, sep = ", ", sep_last = "and ")
Character strings you want in your string.
T/F: would you like to use an oxford comma? Default = TRUE
string. default = ", " but "; " or " " might be what you need!
string. default = " and " but " & " or " , " might be what you need!
text_list(c(1,2,"hello",4,"world",6))
#> [1] "1, 2, hello, 4, world, and 6"
text_list(c(1,"world"))
#> [1] "1 and world"
text_list(c(1,2,"hello",4,"world",6), oxford = FALSE)
#> [1] "1, 2, hello, 4, world and 6"
paste0("here is a list of things: ",
text_list(paste0("list", 1:5), sep = " ", sep_last = ""))
#> [1] "here is a list of things: list1 list2 list3 list4 list5"