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

Description Usage Arguments Value Author(s) Examples

View source: R/Inc.R

Description

Increment a number possibly represented in a character string or factor

Usage

1
Inc(n)

Arguments

n

A number, character string or factor

Value

The incremented value

Author(s)

Georges Monette

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
##---- 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)
    }

p3d documentation built on May 2, 2019, 5:25 p.m.