get_incremental_names: Construct sequence of incremental names

View source: R/get_incremental_names.R

get_incremental_namesR Documentation

Construct sequence of incremental names

Description

Constructs a sequence of names, each of which has an increasing integer appended to it. Digits are padded so that the names are of equal length.

Usage

get_incremental_names(n_items, prefix = NULL, sep = "_", start = 1)

Arguments

n_items

The number of names to generate.

prefix

An optional character name prefix to use. E.g. if prefix is "xyz" and n_items is 3 this will result in names xyz_1, xyz_2 and xyz_3. If NULL the returned names will simply be a sequence of integers which are formatted as strings.

sep

The character separator to use between prefix and the incremental numbers (default is an underscore). Ignored if prefix = NULL.

start

Starting value for the integer sequence.

Value

A character vector of equal-length names with successively incremented integer suffixes.

Examples

get_incremental_names(2, "item")
get_incremental_names(3, "item", sep = "")
get_incremental_names(11, "z")
get_incremental_names(12)
get_incremental_names(3, "a", start = 0)


toniprice/jute documentation built on Jan. 11, 2023, 8:23 a.m.