Simple and 'Scalable' Statistical Modelling in R
Overview
Write statistical models in R and fit them by 'MCMC' and optimisation on 'CPUs' and 'GPUs', using Google 'TensorFlow'. 'greta' lets you write your own model like in 'BUGS', 'JAGS' and 'Stan', except that you write models right in R, it scales well to massive datasets, and it’s easy to extend and build on. See the website for more information, including tutorials, examples, package documentation, and the 'greta' forum. This work is discussed at Golding (2019) doi:10.21105/joss.01601.
Changes
- Add warmup information to the MCMC print method (#652, resolved by #755).
- Cap TensorFlow's internal CPU threadpool inside vignette builds (via
TF_NUM_INTRAOP_THREADSandTF_NUM_INTEROP_THREADS) so CRAN's CPU/elapsed timing on vignette rebuilds stays under the two-core limit (#796). - greta now also caps TensorFlow's CPU thread pools at 2 when running under
R CMD check(detected via the_R_CHECK_LIMIT_CORES_environment variable), so checks on CRAN machines respect the two-core limit (#796). - Reshaping a greta array with
dim<-now keeps the?placeholder display for unknown values instead of showingNA(#582). - Resolve issues with the TensorFlow version in DESCRIPTION: greta no longer requires
== 2.16.0and now accepts>= 2.16.0. - The
n_coresargument now defaults to 2 cores andchainsdefaults to 2 chains; when the number of cores requested exceeds the number detected, the number detected is used. - Use
.batch_sizeinstead ofbatch_sizeinternally, to avoid rare name clash errors (#634). as.unknowns()now handles plain numeric vectors (anddim<-being set toNULL), fixing anmcmc()error "no applicable method for 'as.unknowns'" that surfaced when re-building vignettes under R-devel (#582).greta_notes_tf_num_error()now emits its note withmessage()rather thancat(), so it can be silenced withsuppressMessages()and is written to the message stream.greta_sitrep()gains averbosityargument with three levels of detail: "minimal" (default), "detailed", and "quiet" (#612, resolved by #679).log.greta_array()now warns when thebaseargument is supplied, as it was being ignored (#597).
Show all changes in 0.6.0Hide the rest of the changes in 0.6.0
outer()(and%o%) now works with greta arrays whenFUN = "*", instead of silently returning a base array ofNAs; base R's"*"fast path usedas.vector(), which dropped the greta operation (#582).
Installation and dependencies
- greta now resolves its Python environment more flexibly instead of always forcing reticulate's managed (uv) environment: it respects a user-set
RETICULATE_PYTHON, a stored greta preference, or an existinggreta-env-tf2conda environment, and otherwise uses the managed (uv) environment (#801). - The managed (uv) backend now works without an internet connection, by enabling uv's offline mode (via environment variable
UV_OFFLINE) once reticulate's uv cache is installed. You can setUV_OFFLINE=0(or=1) yourself to force online or offline resolution, respectively (#814). - Fixed
library(greta)failing with an error when greta's stored Python preference file exists but is empty (#809). greta_deps_spec()now only checks that the requested TensorFlow version is one greta supports (TensorFlow 2.16 and later are not supported, as they ship Keras 3); compatible TensorFlow Probability and Python versions are left to uv or conda to resolve rather than being validated against a fixed compatibility table (#675).greta_list_py_modules()shows the Python packages installed in a specific TF2 environment (#801, #809).greta_remove()consolidates greta's Python removal helpers behind a singlewhatargument to remove thegreta-env-tf2conda environment, miniconda, reticulate's uv cache, the stored Python preference, the stored dependency versions, or all of them. This meansdestroy_greta_deps(),greta_remove_all_deps(),remove_greta_env(),remove_miniconda(), andremove_reticulate_uv_cache()are now superseded bygreta_remove()(#814).greta_remove()no longer leaves a stale, deleted environment active for the rest of the session: it now invalidates greta's cached Python backend and nudges you to restart R if you try to use greta again without restarting, instead of silently failing or falsely reporting the removed environment as still available.greta_set_deps()persistently chooses which TensorFlow, TensorFlow Probability, and Python versions greta uses; the managed (uv) environment installs them on next load andinstall_greta_deps()uses them as its default; clear withgreta_remove("deps")(#817).greta_set_python()andgreta_reset_python()let you choose, persistently, which Python environment greta uses - the managed (uv) environment (backend = "uv", the default), a conda environment (backend = "conda"), or a specific Python (backend = "path"); each reports the stored preference, warns ifRETICULATE_PYTHONtakes precedence, and shows what greta will resolve to on its next load (#801, #809, #817).greta_set_python("path", path = ...)accepts either a Python binary or an environment directory (a virtualenv or conda prefix), looking forbin/python(orScripts/python.exeon Windows) inside it, which eases offline and pre-installed setups (#814).greta_sitrep()now reports the resolved Python backend and whether greta can start offline: for the managed (uv) environment, theUV_OFFLINEsetting and whether reticulate's uv cache is populated; a missing conda environment is reported neutrally as "not used" on the managed (uv) backend rather than as a failure (#801, #817).greta_sitrep()now requires Python 3.9 or later (previously 3.8), matching the Python versions greta supports (#809).install_greta_deps()now records the location of thegreta-env-tf2conda environment at install time, so greta auto-detects it in any conda installation, not just reticulate's miniconda (#809).install_greta_deps()is no longer required for most users, as greta now installs TensorFlow and TensorFlow Probability automatically via uv on first use; it remains for installing a conda environment (for example, for offline use), which you can then select withgreta_set_python("conda")(#801).install_greta_deps()now restores thewarning.lengthoption when it exits, instead of leaving its own value in place for the rest of the session.reinstall_greta_env()andreinstall_miniconda()are now deprecated in favour ofreinstall_greta_deps()(#814).remove_greta_env(),remove_miniconda(), andremove_reticulate_uv_cache()ask for confirmation before removing, gain anaskargument (defaultinteractive()) so they work non-interactively, and invisibly return whether anything was removed (#809).remove_reticulate_uv_cache()removes reticulate's uv cache; note this cache is shared by all reticulate packages and is not greta-specific, and a system-wide uv cache is left untouched (#801, #809).
From NEWS.md in the release
Install
Health
- OK13 OK2026-08-05
- NOTE12 OK, 1 NOTE2026-08-01
- OK6 OK2026-07-21
Documentation
- Help pages
- 49 (2 internal)includes a package overview page
- Examples that run
- 21%6 run in a plain check · 23 never run
- Exported functions with examples
- 63%
- Documented parameters
- 93%
- Return-value docs
- 97%
- Help pages citing references
- 0%
- Example models HTML
- FAQ HTML
- Get started with greta HTML
- Installing dependencies HTML
Downloads
Repository
- PRs merged (all time)
- 87%
- Median days to close, 50 most recently updated closed issues
- 782
- Median days to close, 50 most recently updated closed PRs
- 2
Stars over time
Forks over time
Releases over time
Issues over time
PRs over time
Commits over time
Commit identities over time
16 development-tooling and community-health practices detected across 8 families in the upstream repository
Checks run against github.com/greta-dev/greta on 2026-10-22.
The R CMD check workflow runs on Linux, macOS and Windows
GitHub Pages site last deployed 2026-10-14 · The repository has a site deploy workflow
pkgdown site last built 2026-07-21
Show all practicesHide 4 practices
This repository shows signs of AI coding tools.
- Claude Codefirst seen 2026-02-04Named in .Rbuildignore: .claudeNamed in .gitignore: .claudePull request it wrote: opened by a project memberCommits: at least 91 crediting it in the message
- Claude Opus 564 commits · Aug to Sep 2026
- Claude Opus 5.527 commits · Sep to Oct 2026
Dependencies
Installing greta adds 43 packages (19 with compiled code, 12 MB of source tarballs). Heaviest: tfruns 1.9 MB, Rcpp 1.8 MB, reticulate 1.6 MB.
Code & Tests
Datasets
People & History
Show 4 more contributorsHide 4 contributors
Previously maintained by Nick Golding (0.2.0 to 0.3.1).
Pick two releases to compare their code metrics.
- unarchivedReturned to CRAN2026-07-20
- 0.6.0Latest2026-07-20 · current release · diff ↗ ·
removed 1 export
are_nulladded 11 exports
%o%, greta_list_py_modules, greta_remove, greta_remove_all_deps, greta_reset_python, greta_set_deps, greta_set_python, outer, py_module_available, py_version, remove_reticulate_uv_cache - RR 4.6.0 released · 2026-04-24
- archivedRemoved from CRAN2025-09-20errors were not corrected despite reminders
- RR 4.5.0 released · 2025-04-11
- 0.5.02024-11-12 · diff ↗ ·
removed 6 exports
greta_notes_conda_create_error, greta_notes_conda_create_output, greta_notes_conda_install_error, greta_notes_conda_install_output, greta_notes_install_miniconda_error, greta_notes_install_miniconda_outputadded 18 exports
adamax, are_null, as.greta_model, as.unknowns, cpu_only, destroy_greta_deps, gpu_only, greta_create_conda_env, greta_deps_receipt, greta_deps_spec, greta_install_miniconda, greta_set_install_logfile, is.greta_array, is.greta_mcmc_list, nadam, open_greta_install_log, run_optimiser, write_greta_install_log - RR 4.4.0 released · 2024-04-24
- 0.4.52024-03-11 · diff ↗
- 0.4.42024-02-02 · diff ↗
- RR 4.3.0 released · 2023-04-21
- 0.4.3
- RR 4.2.0 released · 2022-04-22
- 0.4.22022-03-22 · diff ↗
- 0.4.12022-03-15 · diff ↗ ·
added 17 exports
chol2symm, cholesky_variable, greta_notes_conda_create_error, greta_notes_conda_create_output, greta_notes_conda_install_error, greta_notes_conda_install_output, greta_notes_install_miniconda_error, greta_notes_install_miniconda_output, greta_notes_tf_num_error, greta_sitrep, install_greta_deps, ordered_variable, reinstall_greta_env, reinstall_miniconda, remove_greta_env, remove_miniconda, simplex_variable - RR 4.1.0 released · 2021-05-18
- RR 4.0.0 released · 2020-04-24
Show 7 earlier eventsHide 7 earlier events
- 0.3.12019-08-09 · diff ↗
- RR 3.6.0 released · 2019-04-26
- 0.3.02018-10-30 · diff ↗ ·
added 36 exports
abind, adadelta, adagrad, adagrad_da, adam, apply, bfgs, calculate, cg, chol2inv, cobyla, cov2cor, eigen, extra_samples, ftrl, gradient_descent, hmc, identity, imultilogit, initials, joint, l_bfgs_b, mixture, momentum, nelder_mead, newton_cg, powell, proximal_adagrad, proximal_gradient_descent, rdist and 6 more - RR 3.5.0 released · 2018-04-23
- 0.2.32018-01-23 · diff ↗ ·
removed 1 export
dynamicsadded 7 exports
.internals, backsolve, colMeans, colSums, forwardsolve, rowMeans, rowSums - 0.2.02017-06-26
- RR 3.4.0 released · 2017-04-21
Package metadata
- First published
- 2017-06-26
- Total releases
- 11 / 9 yrs
- License
- Apache License 2.0 OSI
- Minimum R
- ≥ 4.1.0
- Bundled data
- 0.5 KB / 1 file
- Download size
- 1.2 MB
Cite
Cite this package
Run in R for the authors' entry:
citation("greta")The package provides a citation file, so citation() returns the authors' own entry.
It points to 10.21105/joss.01601.
Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-24, which the citation names so these numbers can be found later. More on citing and the projects behind them.