Learn R Programming

mathgraph (version 0.9-14)

justify: Justify Elements of a Vector

Description

Returns a vector like the input, but each string may have added blank spaces at the start and/or end.

Usage

justify(x, type = "r")

Arguments

x

a character vector.

type

a string giving the type of justification. This may be an abbreviation of one of "right", "left", "center".

Value

a character vector like x, except all elements have the same number of characters, and the text is lined up along one edge, or centered.

References

S Poetry, Patrick J. Burns

See Also

format, substring, paste

Examples

Run this code
# NOT RUN {
data(freeny)
as.matrix(justify(dimnames(freeny.x)[[2]], "r"))
as.matrix(justify(dimnames(freeny.x)[[2]], "l"))
as.matrix(justify(dimnames(freeny.x)[[2]], "c"))
# }

Run the code above in your browser using DataLab