str2int: Convert characters to integers

Description Usage Arguments Value Examples

View source: R/strings.R

Description

Convert one-dimensional character objects to integers.

Usage

1
str2int(string)

Arguments

string

A character vector.

Value

An integer (not necessarily unique).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# Should all produce the same integer (currently results in 124)
str2int("Simulation 1")
str2int("simulation 1")
str2int("SIMULATION 1")
str2int("simulation.1")
str2int("simulation..1")
str2int("simulation-1")
str2int("simulation - 1")
str2int("simulation---1")
str2int("simulation1")

# Potential issues
str2int("abc")  # does not provide unique integers
str2int("cba")

bgreenwell/bmisc documentation built on Sept. 24, 2019, 11:09 a.m.