char2int: Map character elements to integer elements.

Description Usage Arguments Details Value Author(s) See Also

Description

Map character to integer.

Usage

1

Arguments

v

A character vector.

Details

Maps a character vector to an integer vector. Strings are mapped to integers in the order that they are encountered, as enumerated from the beginning of the input vector. All occurances of a given string are mapped to the same integer. Integer enumeration spans 1:n, where n == length(unique(v)).

R> v1 [1] "f" "f" "f" "a" "a" "a" "a" "f" "f" "d" "d" "d" "d" "d" "a" "a" R> char2int(v1) f f f a a a a f f d d d d d a a 1 1 1 2 2 2 2 1 1 3 3 3 3 3 2 2

Value

A vector of class integer.

Author(s)

David Braze davebraze@gmail.com

See Also

series


davebraze/FDB1 documentation built on May 14, 2019, 8:59 p.m.