comma.list: Print out comma separated list of values in X, truncating if...

View source: R/NCmisc.R

comma.listR Documentation

Print out comma separated list of values in X, truncating if many (good for error messages)

Description

Often for nice presentation of error messages you wish to display a list of values. This adds commas between entries and will truncate the list above a length of 50 items with an ellipsis. Very simple but convenient function.

Usage

comma.list(X)

Arguments

X

a vector to be displayed

Value

string with entries separated by commas, and if long, entries skipped indicated by an ellipsis.

Examples

comma.list(1:100)
cat("The following entries were ignored: ", comma.list(c(1,7,10:14)), "\n")

NCmisc documentation built on Oct. 17, 2022, 5:09 p.m.