preName {wikiTools}R Documentation

Reverse the order of the first and last names of every element of a vector.

Description

Reverse the order of the first and last names of every element of a vector.

Usage

preName(X)

Arguments

X

A vector of names with format "name, prename".

Details

This function reverses the order of the first and last names of the items: i.e., "Weber, Max" turns into "Max Weber".

Value

Another vector with its elements changed.

Author(s)

Modesto Escobar, Department of Sociology and Communication, University of Salamanca. See https://sociocav.usal.es/blog/modesto-escobar/

Examples

## To reconvert a single name:
preName("Weber, Max")
## It is possible to work with several items, as in here:
A <- c("Weber, Max", "Descartes, Rene", "Locke, John")
preName(A)

[Package wikiTools version 1.2.7 Index]