Made with
humanparser is a very small package that parses full (human) names into their component parts. Uses code from the node.js humanparser module.
The following functions are implemented:
parse_name
: Parse a "human" name into componentsparse_names
: Parse a character vector of names into a data framedevtools::install_github("hrbrmstr/humanparser")
library(humanparser)
# current verison
packageVersion("humanparser")
#> [1] '0.0.1.9000'
# just one
parse_name("John Smith Jr.")
#> $firstName
#> [1] "John"
#>
#> $suffix
#> [1] "Jr."
#>
#> $lastName
#> [1] "Smith"
#>
#> $fullName
#> [1] "John Smith Jr."
# or a bunch of 'em
full_names <- c("David Regan", "Izaque Iuzuru Nagata",
"Christian Schmit de la Breli", "Peter Doyle", "Hans R.Bruetsch",
"Marcus Reichel", "Per-Axel Koch", "Louis Van der Walt",
"Mario Adamek", "Ugur Tozsekerli", "Judit Ludvai" )
parse_names(full_names)
#> Source: local data frame [11 x 4]
#>
#> firstName lastName fullName middleName
#> 1 David Regan David Regan NA
#> 2 Izaque Nagata Izaque Iuzuru Nagata Iuzuru
#> 3 Christian de la Breli Christian Schmit de la Breli Schmit
#> 4 Peter Doyle Peter Doyle NA
#> 5 Hans R.Bruetsch Hans R.Bruetsch NA
#> 6 Marcus Reichel Marcus Reichel NA
#> 7 Per-Axel Koch Per-Axel Koch NA
#> 8 Louis Van der Walt Louis Van der Walt NA
#> 9 Mario Adamek Mario Adamek NA
#> 10 Ugur Tozsekerli Ugur Tozsekerli NA
#> 11 Judit Ludvai Judit Ludvai NA
library(humanparser)
library(testthat)
date()
#> [1] "Thu Aug 20 15:04:52 2015"
test_dir("tests/")
#> testthat results ========================================================================================================
#> OK: 2 SKIPPED: 0 FAILED: 0
#>
#> DONE
Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.