Skip to content

gratia

0.11.2Package record

Graceful 'ggplot'-Based Graphics and Other Functions for GAMs Fitted Using 'mgcv'

4packages dependsuggested by 2
112.6Kdownloads / year
86.5%test coverage
11/13flavors OK

Overview

About

Graceful 'ggplot'-based graphics and utility functions for working with generalized additive models (GAMs) fitted using the 'mgcv' package. Provides a reimplementation of the plot() method for GAMs that 'mgcv' provides, as well as 'tidyverse' compatible representations of estimated smooths.

Changes in 0.11.2

User visible changes

  • *gratia* now only handles shape constrained models fitted using *scam* version 1.2-21 or later. This is due to breaking changes in *scam*, and new functionality in that package, which simplifies *gratia*.
  • *gratia* also now depends on *dplyr* version 1.2.0 or later.
  • Histogram bars drawn by residuals_hist_plot() and points in qq_plot(), residuals_linpred_plot(), observed_fitted_plot(), and worm_plot(), and hence appraise(), are now filled with a dark shade of grey and use a light colour for the border of the bars.

New features

  • derivatives() now works for constrained factor smooths (bs = "sz"), treating them in the same way as random factor smooths (bs = "fs"). Lack of support reported by @vrest-png #362 Also handles higher order bs = "sz" terms.
Show all changes in 0.11.2Hide the rest of the changes in 0.11.2
  • draw.derivatives() can now differentiate random and constrained factor smooths through the colour aesthetic via new argument differentiate_factor_smooths.
  • model_terms() returns the names of all terms in a model. #388

Bug fixes

  • conditional_values() would fail if supplied a numeric vector of data to condition on via the condition argument. #366
  • *gratia* worked inconsistently with tensor product smooths containing a random effect bs = "re" marginal. Reported #358 and fixed by @asgersvenning #360, with additional changes by Gavin Simpson.
  • Argument mvn_method was not being passed on to the lower workhorse functions that did the sampling. #381
  • response_derivatives() would fail if there were no other terms in the model but the focal term.

From NEWS.md in the release

Install

Health

CRAN checks
2NOTE11OK
Check messages
NOTERd contentsr-devel-linux-x86_64-debian-clang, r-devel-linux-x86_64-debian-gcc
Rd files without \usage:
  ‘fixef.Rd’
\arguments should not be documented without \usage.

CRAN check page ↗

Slowest check: 17.7 min · r-oldrel-macos-x86_64
Status changes
  • NOTE11 OK, 2 NOTENow
  • NOTE12 OK, 1 NOTE2026-07-11
  • OK14 OK2026-03-10
Advisories

none known

Documentation

In release 0.11.2
READMEYes · 660 wordsVignettesYes · 1 · dynamicNEWSYes · 100% structured · mentions 0.11.2Citation fileYes · cites a publicationWebsiteYes · pkgdown

The repository also keeps web-only articles.

Cites a JOSS paper
Help pages
146 (11 internal)includes a package overview page
Examples that run
100%64 run in a plain check
Exported functions with examples
46%
Documented parameters
97%
Return-value docs
47%
Help pages citing references
5%

Downloads

112.6K
CRAN downloads in the past year
Rank #1,663 · ~308/day · ~9.4K/mo
Daily download trend is not available in this view yet.
3.8K30 days
13.1K90 days
112.6K1 year
Compare downloads with other packages →
Also on482 r2u13 autocran

Repository

233Stars
34Forks
35Open issues
0Open PRs
14Releases
3,482Commits
25Commit identities
r-packagegeneralized-additive-modelsggplot2mgcvgamglmlmrandom-effects
3,482 commits · Last activity 2026-10-18 · -0.4% stars, 30d · Default branch at 0.11.2-41, ahead of CRAN 0.11.2 (checked 2026-10-11) · Discussions: 27 posts
Responsiveness
How these are sampled
PRs merged (all time)
73%
Median days to close, 50 most recently updated closed issues
935
Median days to close, 50 most recently updated closed PRs
0

Stars over time

2025-10-08 · 2242026-10-17 · 233
PracticesBeta

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

Checks run against github.com/gavinsimpson/gratia on 2026-10-11.

Continuous integration (2)
GitHub ActionsR CMD check workflow

The R CMD check workflow runs on Linux, macOS and Windows, and on R-devel

Governance and community (4)
Code of conductContributing guide

Funding links: GitHub Sponsors, Buy Me a Coffee

The repository owner accepts GitHub Sponsors

Docs source (4)
README.Rmdpkgdown

GitHub Pages site last deployed 2026-10-11 · The repository has a site deploy workflow

pkgdown site last built 2026-10-11

Coverage (1)
Coverage reporting
Show all practicesHide 5 practices
Reproducibility and dev environment (1)
Makefile
CRAN release process (1)
cran-comments.md
Research and citation (1)
CITATION.cff
Lint, format, editor (1)
lintr
Git structural (1)
.gitattributes
How this is detected·Detection ruleset v3 (2026-09-26)

Dependencies

Declared dependencies
39 external dependencies (excludes base and recommended)

Installing gratia adds 39 packages (21 with compiled code, 54 MB of source tarballs). Heaviest: BH 14 MB, stringi 11 MB, ggplot2 6.0 MB.

Depends (1)
R >= 4.1.0
LinkingTo (0)
none
Enhances (0)
none
Reverse dependencies
4direct
0indirect
Imports 4
Suggested by 2
Depends, Imports or LinkingTo, most downloaded first
Suggests, most downloaded first

Datasets

People & History

People (2)
Author, Maintainer since 0.2-1 (2019), Copyright holder
Contributor · added in 0.3.0
Releases (19)

Pick two releases to compare their code metrics.

  • R
    R 4.6.0 released · 2026-04-24
  • 0.11.2Latest
    record
    2026-02-07 · current release · diff ↗ ·
    added 1 export
    model_terms
  • 0.11.1
    record
    2025-08-25 · diff ↗
  • 0.11.0
    record
    2025-08-18 · diff ↗ ·
    added 6 exports
    assemble, is_mgcv_family, is_multivariate_y, quantile_residuals, rtw, scale_fill_partial_effect
  • R
    R 4.5.0 released · 2025-04-11
  • 0.10.0
    record
    2024-12-19 · diff ↗ ·
    added 3 exports
    conditional_values, dispersion, n_eta
  • 0.9.2
    record
    2024-06-25 · diff ↗
  • R
    R 4.4.0 released · 2024-04-24
  • 0.9.0
    record
    2024-03-27 · diff ↗ ·
    added 20 exports
    add_fitted_samples, add_posterior_samples, add_predicted_samples, add_sizer, add_smooth_samples, basis_size, boundary, derivative_samples, gaussian_draws, generate_draws, mh_draws, model_constant, null_deviance, post_draws, response_derivatives, smooth_label, smooth_terms, spline_values, spline_values2, user_draws
  • 0.8.2
    record
    2024-01-09 · diff ↗
  • R
    R 4.3.0 released · 2023-04-21
  • 0.8.1
    record
    2023-02-02 · diff ↗ ·
    removed 1 export
    seq_min_max
    added 12 exports
    check_is_mgcv_smooth, evenly, level, lp_matrix, model_vars, overview, partial_derivatives, ref_level, smooth_coef_indices, smooth_type, stop_if_not_mgcv_smooth, tidy_basis
  • 0.7.3
    record
    2022-05-09 · diff ↗
  • R
    R 4.2.0 released · 2022-04-22
  • 0.7.2
    record
    2022-03-17 · diff ↗ ·
    added 8 exports
    concrvity, gw_f0, gw_f1, gw_f2, gw_f3, model_concurvity, smooth_data, transform_fun
  • 0.7.0
    record
    2022-02-07 · diff ↗ ·
    added 20 exports
    add_constant, data_combos, factor_combos, family_name, family_type, fitted_values, fixed_effects, fixef, has_theta, model_edf, nb_theta, parametric_effects, rootogram, term_names, term_variables, theta, to_na, too_far, too_far_to_na, typical_values
Show 14 earlier eventsHide 14 earlier events
  • R
    R 4.1.0 released · 2021-05-18
  • 0.6.0
    record
    2021-04-18 · diff ↗ ·
    added 6 exports
    add_confint, compare_smooths, edf, extract_link, variance_comp, worm_plot
  • 0.5.1
    record
    2021-01-24 · diff ↗ ·
    added 1 export
    penalty
  • 0.5.0
    record
    2021-01-11 · diff ↗ ·
    removed 1 export
    data_class
    added 4 exports
    add_partial_residuals, eval_smooth, partial_residuals, smooth_estimates
  • 0.4.1
    record
    2020-05-31 · diff ↗ ·
    removed 1 export
    datagen
    added 6 exports
    add_fitted, add_residuals, data_sim, difference_smooths, is_factor_term, vars_from_label
  • R
    R 4.0.0 released · 2020-04-24
  • 0.3.1
    record
    2020-03-29 · diff ↗ ·
    added 2 exports
    inv_link, link
  • unarchivedReturned to CRAN
    2020-01-19
  • 0.3.0
    record
    2020-01-19 · diff ↗ ·
    added 7 exports
    basis, fitted_samples, load_mgcv, posterior_samples, predicted_samples, smooth_coefs, smooth_samples
  • archivedRemoved from CRAN
    2020-01-16
    check issues were not corrected in time 'Additional issues'
  • R
    R 3.6.0 released · 2019-04-26
  • 0.2-8
    record
    2019-03-13 · diff ↗
  • 0.2-1
    record
    2019-02-01
  • R
    R 3.5.0 released · 2018-04-23

Package metadata

First published
2019-02-01
Total releases
19 / 7 yrs
License
MIT + file LICENSE OSI
Minimum R
≥ 4.1.0
Bundled data
134 KB / 5 files
Download size
4.1 MB

Cite

Cite this package

Run in R for the authors' preferred citation:

citation("gratia")

The package provides a citation file that builds its entry when R runs it. Run citation() to see it.

The repository also keeps a CITATION.cff.

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 gratia version 0.11.2 [Data set]. HJJB, LLC. Data release v2026-10-19. https://doi.org/10.5281/zenodo.21843040

From data release v2026-10-19, 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