Inc: Increment a number possibly represented in a character string...

View source: R/Inc.R

IncR Documentation

Increment a number possibly represented in a character string or factor

Description

Increment a number possibly represented in a character string or factor

Usage

Inc(n)

Arguments

n

A number, character string or factor

Value

The incremented value

Author(s)

Georges Monette

Examples

##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function( n ) {
        n <- as.character(n)
        len <- nchar(n)
        np1 <- as.numeric(n) + 1
        np1c <- as.character(np1)
        len <- max( len, nchar(np1c))
        formatC( np1, flag = '0', width = len)
    }

gmonette/p3d documentation built on Nov. 16, 2023, 11:31 p.m.