substring.with.dots.adv: Produce a string with given length including head, tail and...

View source: R/table-dots-functions.R

substring.with.dots.advR Documentation

Produce a string with given length including head, tail and midsection

Description

Sometimes we need to summarize long strings, and we need a bit og the head and a bit of the tail, and some indication that we are not seeing the full string. This function does that plus it can pad dots or other symbons before of after the string, if it is not long. See also table.dots and substring.with.dots.

Usage

substring.with.dots.adv(c("Hello","khdskhdsjkdkahdshkdhkahskaksdjh"),n=15,reverse=!TRUE,n.last=5)
print(c("Hello ........." ,"khdskhd...aksdj"))

Arguments

x

string to be modified

n

desired length of string after manipulations

reverse

controls if the dots are added before of after the main string

n.last

number of characters from the tail

mid.string

what to put between the head and the tail to indicate that some part of the mid section has been cut out.

Value

string with given length including head, tail and a midsection.

Author(s)

Claus E. Andersen


claus-e-andersen/clanTools documentation built on Nov. 30, 2024, 11:06 p.m.