Predict Gender from Brazilian First Names
Overview
A generalized method to predict and report gender from Brazilian first names using the Brazilian Institute of Geography and Statistics' Census data and neural networks.
This is a new version that introduces a new feature: asymmetrical thresholds for gender classification. In the previous versions, users could set a single threshold to classify names as female or male -- and they could overlap if the threshold was too low. Now, users can set a different threshold for each sex, and there is a new check to prevent overlapping thresholds. The release also includes other improvements and bug fixes.
- The
thresholdargument ofget_gender()andget_gender_nn()now accepts a vector with two values, allowing users to set a different threshold for each sex: the first value is used to classify females and the second, males (e.g.,threshold = c(0.9, 0.8)). The two values can also be named, in any order (c(Female = 0.9, Male = 0.8)orc(F = 0.9, M = 0.8)). A single value keeps setting a symmetrical threshold, as before. - Thresholds that sum to less than 1 are now rejected with an informative error. These values make the female and male bands overlap, so a name could be classified as both. This also applies to a single
thresholdbelow 0.5, which was silently accepted before and gave inconsistent results betweenget_gender()andget_gender_nn(). - Added an
nn_sizeargument toget_gender_nn()andget_gender(nn = TRUE)that splits a large input vector of names into batches. This keeps avoids out-of-memory crashes on big vectors. Defaults toNULL(all names classified in a single pass). - Added a
deviceargument toget_gender_nn()andget_gender(nn = TRUE)to run neural network inference on a GPU ("cuda"or"mps") instead of the default CPU for faster predictions. - Fixed a vocabulary mismatch in the neural network encoder: characters not in the model vocabulary were mapped to
<PAD>instead of the<UNK>. Names containing rare characters are now handled correctly. - Moved
torchfromImportstoSuggests. The neural network model is now built only when the NN backend (get_gender_nn()orget_gender(nn = TRUE)) is used. A clear message tells users to installtorchwhen it is not available. The default methods no longer requiretorch. - Added new tests for the new features and fixes.
From NEWS.md in the release
Install
Health
- OK13 OK2026-08-05
- NOTE12 OK, 1 NOTE2026-08-01
- OK14 OK2026-03-10
Documentation
- Help pages
- 6
- Examples that run
- 20%1 run in a plain check · 4 never run
- Exported functions with examples
- 83%
- Documented parameters
- 100%
- Return-value docs
- 100%
- Help pages citing references
- 33%
Downloads
Repository
- PRs merged (all time)
- 71%
- Median days to close, 50 most recently updated closed issues
- 10
- Median days to close, 50 most recently updated closed PRs
- 0
Stars over time
Forks over time
Releases over time
Issues over time
PRs over time
Commits over time
10 development-tooling and community-health practices detected across 7 families in the upstream repository
Checks run against github.com/meirelesff/genderbr on 2026-10-22.
The R CMD check workflow runs on Linux, macOS and Windows, and on R-devel
Show all practicesHide 3 practices
Dependencies
Installing genderBR adds 16 packages (13 with compiled code, 12 MB of source tarballs). Heaviest: data.table 5.7 MB, openssl 1.1 MB, jsonlite 1.0 MB.
Code & Tests
People & History
Pick two releases to compare their code metrics.
- 1.4.0Latest
- RR 4.6.0 released · 2026-04-24
- 1.3.0
- 1.2.0
- RR 4.5.0 released · 2025-04-11
- RR 4.4.0 released · 2024-04-24
- RR 4.3.0 released · 2023-04-21
- RR 4.2.0 released · 2022-04-22
- RR 4.1.0 released · 2021-05-18
- unarchivedReturned to CRAN2021-05-02
- 1.1.22021-05-02 · diff ↗
- archivedRemoved from CRAN2021-02-21policy violation On Internet access
- 1.1.1
- RR 4.0.0 released · 2020-04-24
- RR 3.6.0 released · 2019-04-26
- RR 3.5.0 released · 2018-04-23
Package metadata
- First published
- 2017-09-05
- Total releases
- 7 / 9 yrs
- License
- GPL (>= 2) OSI
- Minimum R
- ≥ 4.1.0
- Download size
- 673 KB
Cite
Cite this package
Run in R for the authors' preferred citation:
citation("genderBR")This package has no citation file, so citation() returns this entry built from DESCRIPTION.
Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-25, which the citation names so these numbers can be found later. More on citing and the projects behind them.