itostr: Convert Integers to Strings

View source: R/clusters.R

itostrR Documentation

Convert Integers to Strings

Description

Converts integers to strings by the given base and character count.

Usage

itostr(x, base = 10L, nchars = 0L)

Arguments

x

Integer vector, or something coercible to this by as.integer.

base

Integer between 2 and 11 inclusive.

nchars

Minimum number of characters desired. Shorter strings are left-padded with zeros.

Value

A character vector of the same length as x.

See Also

strtoi for the reverse conversion.

Examples

itostr(123, nchars = 4)
strtoi(itostr(123, base = 2), base = 2)
itostr(c(0, 1, 2, 10), base = 2)
itostr(c(0, 1, 2, 10), base = 2, nchars = 4)

falling-fruit/fruitr documentation built on Dec. 21, 2024, 8:32 p.m.