name_reorder {SwimmeR} | R 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 |
verbose |
defaults to |
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"))