Unlimited learning, half price | 50% off
Get 50% off unlimited learning

ProfessR (version 2.4-3)

GetStudentNames: Extract Student Names from Roster.

Description

Given a roster of students, with (lastname, first name) format, extract a unique set of first names, with no blanks.

Usage

GetStudentNames(c1, dup.lets=1)

Value

Character vector of unique first names

Arguments

c1

Character vector

dup.lets

NUmber of letters to add from last name in the event that first names are duplicated.

Author

Jonathan M. Lees<jonathan.lees@unc.edu>

Details

The function assumes the names are comma separated with lastname, firstname order. The code separates the names, removes blanks from the first name, and finds a unique set of names. If first names are not unique, the function extracts the first letters of the last names and the duplicated names and appends with a period.

Examples

Run this code

g.first =c("Jason","Skyler","Adrian","Berkley","Jack",'David',
'David', 'Jim', 'Jim')
g.last =c('Joyce', 'Einstein', 'Hertz', 'Bailey', 'Compton',
'Jones', 'Wilson', 'Smith', 'Anderson' )

c2 = paste(g.last, g.first, sep=', ')

K = GetStudentNames(c2)

Run the code above in your browser using DataLab