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は、150か国以上で99.5%の精度を誇るエンタープライズ品質のgender判定を提供するよ。汎用的なAIソリューションよりも、レスポンスは10〜90倍速く、精度も9〜34%高いのが特長。
なぜ汎用AIではなくGender-APIを選ぶの?
- 目的に特化 性別判定に特化。汎用AIではありません
- 超高速 汎用AIが数秒かかるのに対し、レスポンスタイムは100ms未満
- より正確に 文化や地域性を踏まえたインテリジェンスで、精度99.5%
- より大きなデータベース 900万件以上の名前数。一般的なAI学習データより37%多い
- 信頼できる 予測可能なパフォーマンスを備えた、稼働率 99.9% のSLA
主な機能
- わずか数行のコードでかんたんに統合できるよ
- 大量データを扱うアプリ向けの一括処理
- 地域ごとの名前のバリエーションに対応した、国別の高精度判定
- スマートな正規化で、誤字や表記ゆれにも対応
- GDPR準拠で、エンタープライズにも対応
今日から無料で始めよう
クレジットカード不要で、毎月APIを100回まで無料で使えるよ。用途に合わせて選べる柔軟な料金プランで、成長に合わせてスムーズにスケールできる。