Using the Gender Package in R: Part 1 - Getting Started

There is a package in R called gender and it can be used to determine the gender of a first name. The package is very easy to use and is really powerful. I am planning a few posts related to this package, so I wanted to begin the series of posts with some basic R code to get things started. Below is the basic setup.

Try a few different look ups. For example, search "Morgan" using 1860 to 1950 and then run it again using 1960 to 1990. You will find that the name used to be a man's name, but in the last 50 years it has become a woman's name.

Using the code above we can import a CSV file of first names and append the gender.

I hope you find this information useful. If you have any questions feel free to email me at Jeff@DataPlusScience.com

Jeffrey A. Shaffer

Follow on Twitter @HighVizAbility