headtail: Print head and tail elements of a vector

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/headtail.R

Description

This function prints head and tail elements of a vector for visualization purposes. See examples for its usage.

Usage

1
headtail(vec, head = 2, tail = 1, collapse = ", ")

Arguments

vec

A vector of native types (e.g. character strings)

head

Integer, number of head elements to be printed

tail

Integer, number of tail elements to be printed

collapse

Character string, used to collapse elements

Details

Head and tail elements are concatenated with ellipsis, if there are any elements that are not shown in the vector.

Value

A character string representing the vector

Author(s)

Jitao David Zhang <jitao_david.zhang@roche.com>

See Also

head, tail

Examples

1
2
3
4
5
6
7
8
testVec1 <- LETTERS[1:10]
headtail(testVec1)
headtail(testVec1, head=3, tail=3)
headtail(testVec1, head=3, tail=3, collapse="|")

testVec2 <- letters[1:3]
headtail(testVec2, head=1, tail=1)
headtail(testVec2, head=2, tail=1)

ribiosUtils documentation built on March 13, 2020, 2:54 a.m.