R Package

R package for Gender-API.com enabling seamless gender detection in your statistical analysis and data science workflows. Our API delivers 99.5% accuracy across 150+ countries, perfect for demographic research, survey analysis, and data cleaning. Process entire datasets efficiently with vectorized operations and batch support. Unlike generic AI models, our specialized database is 37% more comprehensive with 10x-90x faster response times. Ideal for academic research, market analysis, and social science studies. The package integrates smoothly with tidyverse, data.table, and other R ecosystems. Handle international names with advanced character set support. Start free with 100 monthly API calls, no credit card required.

Nejprve nainstalujte naši knihovnu pomocí composeru:

Zde naleznete kompletní dokumentaci klienta:

https://github.com/markus-perl/gender-api-client

Nejprve nainstalujte naši knihovnu pomocí npm:

Zde naleznete kompletní dokumentaci klienta:

https://github.com/markus-perl/gender-api-client-npm

Nejprve nainstalujte naši knihovnu pomocí npm:

Zde naleznete kompletní dokumentaci klienta:

https://github.com/markus-perl/gender-api-client-npm

Nejprve si nainstaluj naši knihovnu pomocí pip:

Zde naleznete kompletní dokumentaci klienta:

https://github.com/markus-perl/gender-api-client-python
https://pypi.org/project/gender-api-client/

install.packages(c("httr2", "dplyr", "tibble", "jsonlite"))
#' Gender API Client (single name only)
#'
#' Gets gender by a first name, optionally filtered by country.
#'
#' @param name A character string containing a single first name.
#' @param country Optional two-letter country code, see: https://gender-api.com/en/api-docs
#' @param api_key Your Gender-API.com API key.
#'
#' @return A tibble containing the estimated gender, number of samples,
#'   accuracy (0–100), and the request duration in ms.
#' @export
#'
#' @examples
#' \dontrun{
#' gender("Andrea", country="US", api_key="YOUR_KEY")
#' gender("Andrea", country="IT")
#' }
#'
library(httr2)
library(dplyr)

gender <- function(name, country = NULL, api_key = Sys.getenv("GENDER_API_KEY")) {
  if (missing(name) || length(name) != 1) {
    stop("`name` must be a single string.")
  }
  if (is.null(api_key) || api_key == "") {
    stop("API key is required. Set with `Sys.setenv(GENDER_API_KEY='your_key')` or pass via `api_key`.")
  }

  args <- list(
    key = api_key,
    name = name
  )
  if (!is.null(country)) args$country <- country

  resp <- request("https://gender-api.com/get") %>%
    req_url_query(!!!args) %>%
    req_perform()

  if (resp_status(resp) >= 400) {
    stop("Request failed: ", resp_status_desc(resp))
  }

  out <- resp_body_json(resp, simplifyVector = TRUE)

  tibble::as_tibble(out)
}

gender("Andrea", country="US", api_key="<YOUR API KEY>")

Professional Gender Detection for Your Applications

Gender-API.com delivers enterprise-grade gender detection with 99.5% accuracy across 150+ countries. Our specialized API outperforms generic AI solutions with 10x-90x faster response times and 9-34% better accuracy.

Why Choose Gender-API Over Generic AI?

  • Purpose-Built : Specialized for gender detection, not a general-purpose AI
  • Blesková rychlost : Sub-100ms response times vs. seconds for generic AI
  • More Accurate : 99.5% accuracy with cultural and regional intelligence
  • Larger Database : 9+ million names, 37% more than typical AI training data
  • Reliable : 99.9% uptime SLA with predictable performance

Key Features

  • Easy integration with just a few lines of code
  • Batch processing for high-volume applications
  • Country-specific accuracy for regional name variations
  • Smart normalization handling typos and variants
  • GDPR compliant and enterprise-ready

Start Free Today

Get 100 free API calls per month with no credit card required. Scale as you grow with flexible pricing for every use case.

Chat