Learn R Programming

SciencesPo (version 1.02.12)

nameSplit: Splits name field variable

Description

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

Usage

nameSplit(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 a name is region dependent, so this function may only 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") )
nameSplit(df$name)
df$n<- nameSplit(df$name)

Run the code above in your browser using DataLab