embedLetters: embedLetters

Description Usage Arguments Details Value Examples

View source: R/embedLetters.R

Description

Embed a character vector into one-hot encoded array

Usage

1
embedLetters(names, max.length = 12)

Arguments

names

Character vector

max.length

Numeric representing number of letters to keep for each name. Names shorter than max.length will be padded with 0s from the right

Details

One-hot encoding will have dimension 28 for 27 lower case letters as well as a space

Value

Binary array with dimension: length(names) x max.length x 28

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Not run: 
# Sample names 
names <- c('amy', 'john', 'cathy')

# Embed 
embedded <- embedLetters(names, max.length = 12)

dim(embedded)
> [1] 3  12  28

## End(Not run)

kailin-lu/recordlinkR documentation built on May 4, 2019, 7:37 a.m.