pretty.string {QCA}R Documentation

Separate a very long vector of strings on several rows

Description

When displaying the minimized prime implicants or the row names from the original dataset, it sometimes happens that this vector is too large to be displayed on a single row, therefore R splitts it at some letter when printing it. This function takes care of that, by specifying the maximum number of characters for each row such that no prime implicants or row names will be splitted.

Usage

pretty.string(string.vector, string.width=60, repeat.space=5, separator=",")

Arguments

string.vector a vector of strings
string.width the length of the row, in number of characters (default to 60)
repeat.space the number of space characters for the white space from the beginning of the line (default to 5)
separator character to use for separating the vector elements (default to comma)

Author(s)

Adrian Dusa
Romanian Social Data Archive, University of Bucharest
adi@roda.ro

See Also

cat, strsplit

Examples

set.seed(1234)
long.string <- paste("This would be a very long string, composed from the following words:", 
                     paste(sample(c("one", "two", "three"), 60, replace=TRUE), collapse=" "))

long.string

string.vector <- unlist(strsplit(long.string, " "))

# a row length of 70, no space at the beginning
cat(pretty.string(string.vector, 70, 0, " "), "\n")

# a row length of 50, inserting 7 spaces before each row
cat("      ", pretty.string(string.vector, 50, 7, " "), "\n")


[Package QCA version 0.1-1 Index]