names_to_codes {COINr} | R Documentation |
Generate short codes from long names
Description
Given a character vector of long names (probably with spaces), generates short codes. Intended for use when importing from the COIN Tool.
Usage
names_to_codes(cvec, maxword = 2, maxlet = 4)
Arguments
cvec |
A character vector of names |
maxword |
The maximum number of words to use in building a short name (default 2) |
maxlet |
The number of letters to take from each word (default 4) |
Details
This function replaces the now-defunct names2Codes()
from COINr < v1.0.
Value
A corresponding character vector, but with short codes, and no duplicates.
See Also
-
import_coin_tool()
Import data from the COIN Tool (Excel).
Examples
# get names from example data
iNames <- ASEM_iMeta$iName
# convert to codes
names_to_codes(iNames)
[Package COINr version 1.1.14 Index]