genderapi_gender: Infer gender for one name, email address or username

View source: R/gender.R

genderapi_genderR Documentation

Infer gender for one name, email address or username

Description

Sends one POST /gender request (one billable operation). The request is never retried. A successful unknown result is billable and is returned, not raised as an error.

Usage

genderapi_gender(
  type,
  value,
  country = NULL,
  ai_mode = NULL,
  force_to_genderize = FALSE,
  id = NULL,
  client = genderapi_client()
)

genderapi_name(
  value,
  country = NULL,
  ai_mode = NULL,
  force_to_genderize = FALSE,
  id = NULL,
  client = genderapi_client()
)

genderapi_email(
  value,
  country = NULL,
  ai_mode = NULL,
  force_to_genderize = FALSE,
  id = NULL,
  client = genderapi_client()
)

genderapi_username(
  value,
  country = NULL,
  ai_mode = NULL,
  force_to_genderize = FALSE,
  id = NULL,
  client = genderapi_client()
)

Arguments

type

One of "name", "email" or "username".

value

The name, email address or username: 1 to 254 characters, not only whitespace, no control characters.

country

Optional ISO 3166-1 alpha-2 code in upper case, such as "TR". Omit it when unknown.

ai_mode

Optional "off", "fallback" or "always". When omitted the server default applies: fallback for single requests and off for batch items. fallback costs 1 credit in total; always costs 2.

force_to_genderize

TRUE to try the dataset first and, if gender is unknown, infer it from nickname or alias semantics (2 credits in total in that case). Cannot be combined with ai_mode "off" or "always".

id

Optional item id, 1 to 64 characters. In a batch, ids must be unique and are echoed back in each result.

client

A genderapi_client().

Details

genderapi_name(), genderapi_email() and genderapi_username() are shortcuts for genderapi_gender() with the matching type.

Value

A genderapi_prediction: the parsed V2 JSON as a list with data (the prediction) and meta (request_id, duration_ms, access, usage). All fields are kept as sent, including fields added by future API versions. JSON null becomes NULL. Key fields of data: gender ("male", "female" or NULL), result_status ("identified" or "unknown"), reason, confidence with confidence_kind ("observed_frequency" or "model_reported"; not a calibrated probability), sample_count, source, name, country, country_source and match. Use as.data.frame() for a one-row data frame.

See Also

genderapi_batch(), genderapi_error

Examples

## Not run: 
# Sends a request and may consume credits.
res <- genderapi_name("Onur", country = "TR")
res$data$gender
res$data$result_status
res$meta$usage$charged_credits
as.data.frame(res)

## End(Not run)

genderapi documentation built on Oct. 1, 2026, 5:13 p.m.