Learn R Programming

berryFunctions (version 1.22.5)

truncMessage: truncate message parts

Description

truncate long vectors for messages

Usage

truncMessage(
  x,
  ntrunc = 3,
  prefix = "s",
  midfix = " ",
  altnix = "'",
  sep = ", "
)

Value

Character string

Arguments

x

Character vector

ntrunc

Integer: number of elements printed before truncation. DEFAULT: 3

prefix

Character: Prefix added if length(x)>1. DEFAULT: "s"

midfix

Character: string added after prefix OR before first altnix. DEFAULT: " "

altnix

Character: Alternative string padded around x if length(x)==1. DEFAULT: "'"

sep

Character: Separator between elements. DEFAULT: ", "

Author

Berry Boessenkool, berry-b@gmx.de, Nov 2016

See Also

Examples

Run this code
truncMessage("hi")
message("listing name", truncMessage(       "hi"      ), ".")
message("listing name", truncMessage(paste0("hi",1:10)), ".")
truncMessage(paste0("hi",1:10), ntrunc=1)
truncMessage(paste0("hi",1:10), ntrunc=2, prefix="", midfix="")
truncMessage(paste0("hi",1:10), ntrunc=8, prefix="files _ ")

Run the code above in your browser using DataLab