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.
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>") اكتشاف احترافي للجنس لتطبيقاتك
Gender-API.com يقدّم لك تحديد جنس الاسم بمستوى مؤسسي وبدقة 99.5% عبر أكثر من 150 دولة. واجهة الـAPI المتخصصة عندنا تتفوّق على حلول الذكاء الاصطناعي العامة بسرعات استجابة أسرع بـ10 إلى 90 مرة، وبدقة أعلى بنسبة 9% إلى 34%.
ليش تختار Gender-API بدل الذكاء الاصطناعي العام؟
- مصمّم خصيصًا متخصص في تحديد gender، وليس ذكاءً اصطناعيًا عامًا متعدد الاستخدامات
- سرعة البرق : أوقات استجابة أقل من 100 ملّي ثانية مقابل ثوانٍ مع الذكاء الاصطناعي العام
- أكثر دقة دقّة 99.5% مع ذكاء ثقافي وإقليمي
- 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
ابدأ مجانًا اليوم
Get 100 free API calls per month with no credit card required. Scale as you grow with flexible pricing for every use case.