Function to estimate the gender from a first name. Connects directly to the genderize.io API sending a request with a name and parses the response to return the predicted gender.
genderize( name, country_id = NULL, simplify = TRUE, apikey = get_api_key(), meta = FALSE )
name | Name/s to estimate the gender. Can be a single |
---|---|
country_id | Responses will in a lot of cases be more accurate if the
data is narrowed to a specific country. This optional parameter allows to
specify a specific country. The parameter must be a country code following
the common ISO
3166-1 alpha-2 country code convention. To see a list of the supported
countries use the |
simplify | Defines if the result should be returned as a single vector
or a
|
apikey | Optional parameter to pass the API key. The API is free for up
to 1000 names/day. No sign up or API key needed. Yet, if more requests
would be needed, visit the genderize.io
store and the obtained API key can be passed through this parameter. The
API can also be saved one time through the |
meta |
|
The estimated age in a single character
vector form or a
data.frame
with additional information.
The function automatically handles pagination (max. 10 names per API
request), missing values & duplicated values. If a name is duplicated for
the same country_id
(if the parameter has been passed), it will
handle the request as a a single name to save requests, returning the same
value for the duplicated names. To see more details about the API
documentation, visit the genderize.io
website.
Please be aware about local privacy protection regulations such as GDPR when dealing with personal data.
#> [1] "male" "female"# }