Skip to content

heaping

0.2.0Package record

Correction of Heaping on Individual Level

0packages depend
1.9Kdownloads / year
87.9%test coverage
13/13flavors OK

Overview

About

Provides methods for correcting heaping (digit preference) in survey data at the individual record level. Age heaping, where respondents disproportionately report ages ending in 0 or 5, is a common phenomenon that can distort demographic analyses. Unlike traditional smoothing methods that only correct aggregated statistics, this package corrects individual values by replacing a calculated proportion of heaped observations with draws from fitted truncated distributions (log-normal, normal, or uniform). Supports 5-year and 10-year heaping patterns, single heap correction, survey weights, and optional covariate-conditional (model-based) correction via quantile regression forests or linear models to preserve relationships. A multiple-imputation wrapper repeats the correction to propagate the added uncertainty into downstream inference.

Changes in 0.2.0

Major changes

  • correctHeaps() and correctSingleHeap() gain survey-weight support via a new weight= argument. Heaping ratios and the selection of records to correct then use weighted counts (records are drawn uniformly and accumulated until their cumulative weight covers the excess mass).
  • **Breaking:** model-based correction is redesigned. Instead of a random-forest sign-adjustment heuristic, correctHeaps(model=, dataModel=) now fits an imputation model for age given the covariates on the *retained* ("trusted") records and draws covariate-conditional replacements for the selected heaped records. The engine is selectable via model.engine = c("ranger", "lm") (a ranger quantile forest by default). Corrected values therefore differ from 0.1.x, even with the same seed.
Show all changes in 0.2.0Hide the rest of the changes in 0.2.0
  • New width= argument controls the truncation half-window; 10-year heaps now use a single symmetric window instead of the previous two-stage +/-4 / +/-5 correction.
  • New correctHeapsMI() produces m corrected datasets (with deterministically derived seeds) for multiple-imputation inference, with a print() method for the returned heapingMI object.

Internal

  • Removed the internal helpers .adjust_signs() and the legacy .draw_replacements(); the correction engine now lives in R/impute-model.R.

From NEWS.md in the release

Install

Health

CRAN checks
13OK
Slowest check: 2.4 min · r-release-macos-x86_64
Status changes
  • OK13 OK2026-08-05
  • NOTE12 OK, 1 NOTE2026-08-01
  • OK14 OK2026-03-10
Advisories

none known

Documentation

In release 0.2.0
READMENoVignettesYes · 1 · dynamicNEWSYes · 100% structured · mentions 0.2.0Citation fileNoWebsitenot declared in DESCRIPTION
Help pages
15includes a package overview page
Examples that run
100%14 run in a plain check
Exported functions with examples
100%
Documented parameters
100%
Return-value docs
100%
Help pages citing references
73%

Downloads

1.9K
CRAN downloads in the past year
Rank #18,848 · ~5/day · ~154/mo
Daily download trend is not available in this view yet.
27130 days
68890 days
1.9K1 year
Compare downloads with other packages →
Also on54 r2u2 autocran

Repository

0Stars
0Forks
0Open issues
0Open PRs
0Releases
License file reads as GPL-3.0 · Last activity 2026-07-13
Responsiveness
not measured
PracticesBeta

2 development-tooling and community-health practices detected across 2 families in the upstream repository

Checks run against github.com/matthias-da/heaping on 2026-10-18.

CRAN release process (1)
cran-comments.md
Lint, format, editor (1)
RStudio project
How this is detected·Detection ruleset v3 (2026-09-26)
AI coding toolsBeta

This repository shows signs of AI coding tools.

  • Claude Codefirst seen 2026-01-29
    Named in .gitignore: .claude, CLAUDE.md
    Commits: at least 8 crediting it in the message
Models named in its commits
  • Claude Opus 4.84 commits · Jun to Jul 2026
  • Claude Fable 52 commits · Jul 2026
  • Claude Opus 4.51 commit · Jan 2026
  • Claude Opus 4.61 commit · Mar 2026
Counts are commits, not lines of code. Commits by a tool's accounts count once across all of its accounts. Commits crediting it are the largest count among its credit lines, a minimum.How this is detected·Detection ruleset v4 (updated 2026-09-27)

Dependencies

Declared dependencies
10 external dependencies (excludes base and recommended)

Installing heaping adds 20 packages (7 with compiled code, 17 MB of source tarballs). Heaviest: ggplot2 6.0 MB, fitdistrplus 2.4 MB, isoband 1.5 MB.

Depends (1)
R >= 3.5.0
Imports (3)
LinkingTo (0)
none
Enhances (0)
none
Reverse dependencies
0direct
0indirect

Nothing depends on this yet.

Datasets

People & History

People (2)
Author, Maintainer since 0.1.0 (2026)
Contributor
Releases (2)

Pick two releases to compare their code metrics.

  • 0.2.0Latest
    record
    2026-07-13 · current release · diff ↗ ·
    added 1 export
    correctHeapsMI
  • R
    R 4.6.0 released · 2026-04-24
  • 0.1.0
    record
    2026-02-09
  • R
    R 4.5.0 released · 2025-04-11

Package metadata

First published
2026-02-09
Total releases
2 / 1 yrs
License
GPL (>= 2) OSI
Minimum R
≥ 3.5.0
Bundled data
236 KB / 1 file
Download size
465 KB

Cite

Cite this package

Run in R for the authors' preferred citation:

citation("heaping")
Templ, M., & Meindl, B. (2026). heaping: Correction of Heaping on Individual Level (Version 0.2.0) [Computer software]. https://doi.org/10.32614/CRAN.package.heaping

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.

APA

Balamuta, J. J. (2026). R Observatory: Metrics for heaping version 0.2.0 [Data set]. HJJB, LLC. Data release v2026-10-20. https://doi.org/10.5281/zenodo.21843040

From data release v2026-10-20, which the citation names so these numbers can be found later. More on citing and the projects behind them.

Report a problem with this page →

Privacy choices

These apply to this browser and are stored on this device only. Nothing about your choice is sent to us.

Read the privacy policy