Learn R Programming

mosaic (version 1.9.1)

surround: Format strings for pretty output

Description

Format strings for pretty output

Usage

surround(x, pre = " ", post = " ", width = 8, ...)

Value

a vector of strings padded to the desired width

Arguments

x

a vector

pre

text to prepend onto string

post

text to postpend onto string

width

desired width of string

...

additional arguments passed to format()

Examples

Run this code
surround(rbinom(10,20,.5), " ", " ", width=4)
surround(rnorm(10), " ", " ", width=8, digits = 2, nsmall = 2)

Run the code above in your browser using DataLab