spsurvey (version 4.1.4)

vecprint: Internal Function: Create Vector to Print

Description

This function takes an input vector and outputs a character string with line breaks inserted so that, whenever possible, no line in the string exceeds the input value n.char, which is set to 78 characters by default. The input vector is coereced to mode character. When an element of the input vector is greater than n.char characters in length, then that element is inserted in the output character string as an individual line.

Usage

vecprint(x, n.char = 78)

Arguments

x

Character vector.

n.char

The maximum number of characters per line. The default is 78.

Value

Character string that is suitable for printing by the functions: stop, warning, or cat.

Examples

Run this code
# NOT RUN {
sites <- paste("Site Number", 1:50)
sites.str <- vecprint(sites)
cat(sites.str)

temp <- c(1, 5, 21:25, 33:37)
sites.str <- vecprint(sites[temp])
warning(paste("\nThe following site ID values were removed from the
  analysis:\n", sites.str, sep=""))

# }

Run the code above in your browser using DataLab