Skip to contents

Keeps only the first character of each token ("ANNA" becomes "A"). Use it to match on initials when full first names are recorded inconsistently, for example when one source has "Anna Berta Schmidt" and another "A. B. Schmidt".

Usage

extract_initials(tokens)

Arguments

tokens

A list of character vectors.

Value

A list of character vectors of single-character initials.

Details

It transforms a token column, so it runs after a token generator such as word_tokens().

Examples

extract_initials(list(c("Anna", "Berta")))
#> [[1]]
#> [1] "A" "B"
#> 
# list(c("A", "B"))