name_reorder: Orders all names as "Firstname Lastname"

View source: R/name_reorder.R

name_reorderR Documentation

Orders all names as "Firstname Lastname"

Description

Names are sometimes listed as Firstname Lastname, and sometimes as Lastname, Firstname. The names_reorder function converts all names to Firstname Lastname based on comma position. The reverse, going to Lastname, Firstname is not possible because some athletes have multiple first names or multiple last names and without the comma to differentiate between the two a distinction cannot be made.

Usage

name_reorder(x, verbose = FALSE)

Arguments

x

a data frame output from swim_parse containing a column called Name with some names as Lastname, Firstname

verbose

defaults to FALSE. If set to TRUE and if x is a data frame then returned data frame will include columns First_Name and Last_Name extracted as best as possible from Name

Value

a data frame with a column Name_Reorder, or a list, containing strings reordered as Firstname Lastname in addition to all other columns in input df. Can also contain columns First_Name and Last_Name depending on value of verbose argument

Examples

name_reorder(
data.frame(
Name = c("King, Lilly",
 "Lilly King",
 NA,
 "Richards Ross, Sanya",
 "Phelps, Michael F")),
verbose = TRUE
)
name_reorder(c("King, Lilly", "Lilly King", NA, "Richards Ross, Sanya"))


gpilgrim2670/SwimmeR documentation built on March 26, 2023, 5:05 p.m.