Learn R Programming

twitterreport (version 0.15.11)

tw_gender: Matches text with male/female names

Description

Using names+gender dataset, matches a list of Names with a dictionary and sets the gender of the name.

Usage

tw_gender(Names, male = NULL, female = NULL, lan = c("en"), rm.no.alpha = TRUE)

Arguments

Names
Character vector of names/text to analyze and match
male
Character vector of male names
female
Character vector of female names
lan
Languaje of the names
rm.no.alpha
Whether or not to remove no alpha characters

Value

A factor vector assigning gender to each Name provided.

Details

The char match is written in C++, which is why it should be fast.

When no male or female names are provided, the function uses by default the names datasets names_male_en and names_female_en (if lan='en').

If lan='es' and no list of male or female names is provided, the function will load the names_male_es and names_female_es datasets. Note that if lan=c('es','en') the function will use both.

The argument rm.no.alpha, by default in TRUE set whether or not to remove no letter characters before analyzing the data.

Examples

Run this code
# Some list of names
mix <- c('pedro','peter','mariano','maria jose','pablo','paul','jenny')
tw_gender(mix)

Run the code above in your browser using DataLab