Learn R Programming

ribiosUtils (version 1.5-6)

headtail: Print head and tail elements of a vector

Description

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

Usage

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

Value

A character string representing the vector

Details

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

See Also

head, tail

Examples

Run this code
# NOT RUN {
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)

# }

Run the code above in your browser using DataLab