Learn R Programming

SciencesPo (version 1.3.5)

name.slicer: Splits name fields

Description

Splits a name field variable allocating the first and last names into two new columns or a list.

Usage

name.slicer(name, data = .data)

Arguments

name
the name field column.
data
the data.frame name.

Value

  • two columns or a list.

encoding

UTF-8

Details

The way one may split names is region dependent, so this function may apply to very few contexts. See for instance http://www.w3.org/International/questions/qa-personal-names

See Also

unnest.

Examples

Run this code
df <- data.frame( name = c("Martin Luther King",
 "Nelson Mandela", "Simon Bolivar") )
 name.slicer(df$name)
 df$n<- name.slicer(df$name)

Run the code above in your browser using DataLab