Learn R Programming

sfsmisc (version 1.0-15)

repChar: Make Simple String from Repeating a Character, e.g. Blank String

Description

Simple constructors of a constant character string from one character, notably a blank string of given string length.

M.M. is now mentally deprecating bl.string in favor of using repChar() in all cases.

Usage

repChar(char, no)
bl.string(no)

Arguments

char
single character (or arbitrary string).
no
non-negative integer.

Value

  • One string, i.e., character(1)), for bl.string a blank string, fulfilling n == nchar(bl.string(n)).

See Also

paste, character, nchar.

Examples

Run this code
r <- sapply(0:8, function(n) ccat(repChar("",n), n))
cbind(r)

repChar("-", 4)
repChar("_", 6)
## it may make sense to a string of more than one character:
repChar("-=- ", 6)

## show the very simple function definitions:
repChar
bl.string

Run the code above in your browser using DataLab