r/rstats • • 1h ago

More assignment operators in R

• Upvotes

It's so odd for R to have no arithmetic assignment operators like +=, which this feature is so convenient to write. Python has them, Julia has them - the list still keeps coming up. I know you can write your own infix operator in R, enclosing them with %%:

`%+=%` <- function(e1, e2) {
  eval(substitute(e1 <- e1 + e2), envir = parent.frame())
}
a <- 2
a %+=% 7
a  # 9

But would be nice if R has them.


r/rstats • • 3h ago

[Software] SimtablR: Quick and Easy Epidemiological Tables, Diagnostic Tests, and Multi-Outcome Regression - version 3 now available on CRAN!

Thumbnail
1 Upvotes

r/rstats • • 9h ago

nlmixr2save 0.2.0, now on CRAN: fits you can read, runs you don't repeat

3 Upvotes

A pharmacometric fit can take minutes to weeks. nlmixr2save keeps that fit readable, and skips the rerun when nothing has changed.

A fit is the saved result of estimating a drug model against observed data, such as measured concentrations.

The nlmixr2 Working Group’s latest post introduces nlmixr2save 0.2.0, now on CRAN. saveFit() stores a fit as text: models as R source, tables as CSV, bundled in one zip. loadFit() brings back a working fit for plots, visual predictive checks, and the next model. Switch <- to := and a script or report loads from cache until the model, the data, or the estimation options change.

Matthew Fidler covers the same material on the nlmixr2save poster at ACoP 2026 (October 11–14, National Harbor).

A 7-minute walkthrough is linked from the post.

https://r-consortium.org/posts/nlmixr2save/


r/rstats • • 1d ago

Anyone Else Feel That RStudio IDE Is Far Superior to Positron?

128 Upvotes

In my experience, Positron feels extremely laggy, slow, and riddled with bugs. Meanwhile, RStudio has been blazing fast, stable, and virtually trouble-free. I've rarely encountered issues with environment dependencies, package installations, or general usability.

It literally takes about five minutes to install R and RStudio and get straight to work. Everything just works, without having to spend time troubleshooting the IDE itself.

I really hope Posit continues actively developing and supporting RStudio rather than eventually forcing everyone to migrate to Positron

To me, RStudio is a much more polished, reliable, and efficient IDE for working with R. I genuinely don't see the appeal of moving to Positron when RStudio already does its job so well.

Rstudio should also support seamless Python integration, hate to use Positron just for Python


r/rstats • • 21h ago

Should I include samples for all comparisons in one DESeq2 script or should I run individual DESeq2 runs for each comparison?

Thumbnail
1 Upvotes

r/rstats • • 1d ago

[Package] ParBayesianOptimization is back on CRAN

14 Upvotes

Hi,

Some people may remember that the author of this package posted last year about changing package ownership because he didn’t had time to resolve issues that eventually caused the package to be removed from CRAN.

I suggested a PR but since he didn’t respond in a while I decided to resubmit the package back to CRAN from my fork and maintain it at least for the time being.

I thought it’s a good idea to post here as the package seems quite popular.

If any users find issues or want to contribute the code is now maintained on my GitHub: https://github.com/novica/ParBayesianOptimization


r/rstats • • 1d ago

Liquid Glass themes for Shiny. 0.5.0 is on CRAN.

Post image
5 Upvotes

What's new:

  • Closer to iOS 27 Liquid Glass: a refraction lens at the glass edges (Chromium), tab indicators that slide between items, buttons that spring when pressed, and tab bars that shrink as you scroll
  • Mobile ready: 44px tap targets, phone sidebars open as a full overlay, and no sideways scroll at iPhone widths
  • Every live demo has a phone preview button on desktop
  • shinychat apps pick up the glass look, shown off in a new chat demo (Harbor notes) that can reply live with Gemini
  • shinyreact support, with React glass components that share the same theme
  • The ?shinyglass help page now walks through the whole setup

Heads up that some visual defaults changed on purpose. The migrating vignette shows how to get the 0.4.0 look back.

install.packages("shinyglass")

Live demos (may take a few seconds to wake):

Docs: https://ericrayanderson.github.io/shinyglass/

CRAN: https://cran.r-project.org/package=shinyglass


r/rstats • • 1d ago

Med Student Learning R

Thumbnail
1 Upvotes

r/rstats • • 2d ago

[Package] tidycreel is now on CRAN: design-based creel survey analysis in R

14 Upvotes

I maintain tidycreel, which has just been accepted on CRAN as version 8.0.0.

Creel surveys use angler counts and interviews to estimate fishing effort, catch, and harvest. The analysis depends on how days, sites, and anglers were sampled. tidycreel provides a tidy, pipe-friendly interface for keeping that survey structure attached to the data, with the survey package supplying the design-based foundation.

The core workflow is to define a survey calendar and strata, attach count and interview data, check coverage and data quality, and estimate effort, rates, and totals with uncertainty. The distinction between completed access-point trips and incomplete roving interviews matters when choosing a rate estimator.

Install the CRAN release:

install.packages("tidycreel")

The source package is available now. Windows and macOS binaries are pending; I expect them within the next couple of days. Until then, use install.packages("tidycreel", type = "source") if a binary is unavailable. tidycreel itself has no compiled code, although source-built dependencies may need build tools.

For development changes ahead of CRAN:

install.packages("pak")  # If needed
pak::pak("chrischizinski/tidycreel")

In 8.0.0, aerial catch, harvest, and release totals are underestimated; use the GitHub development version for those totals until 8.0.1 reaches CRAN (release notes). Non-aerial designs are unaffected.

There are 24 package vignettes, a practical blog series, and the companion book Modern Creel Survey Analysis in R. The book remains a work in progress and develops the sampling and statistical reasoning behind the workflows.

I also wrote a short release post with installation instructions and links to these resources.

I would welcome feedback from people working with creel or other field survey data, especially on data structures and diagnostics. What sampling or data coverage problems are hardest to make visible in your current workflow?

Source and issue tracker.


r/rstats • • 2d ago

Calculating tree regression Shap contributions in R is a mess

8 Upvotes

I am more of a stats guy, so I don't do this every day, but I needed to describe some nonlinear relationships by category in a lightweight way.

It seems Shap contributions are a valid and popular approach. Not the Shap values (a vector), but the contributions by variable (a matrix or data frame).

Here's my experience trying to do this in R.

  1. I first tried {ranger}. ranger makes is easy to fit, predict, and get importances, but does not have any support for Shap contributions.

  2. I tried to use {fastshap} in combination with ranger. fastshap is removed from CRAN! This is the package author's comment on the package GitHub. "fastshap is no longer available on CRAN due to CRAN’s stringent and ever-changing policies. It is now hosted on r-universe, which provides a reliable alternative for distributing R packages."

  3. I tried to use {treeshap} instead. treeshap is on CRAN. treeshap needs to unify tree regression objects first from various packages (ranger, xgboost, etc.). treeshap::ranger.unify() crashed R 66% of the time! When it does succeed, treeshap::importance() crashed R 100% of the time!

  4. I found that {xgboost} has support for Shap contributions within its own package. Good. I fit a model successfully. I calculate the Shap contributions by predict(model, newdata = x, predcontrib = TRUE) . This only returns the Shap values (vector; not matrix). Why? Is predcontrib not doing anything? I debug for a long time. I find that my fit model is an xgboost object, and there is another possible model object produced by the package of class xgb.Booster. The method I thought I was using was predict.xgb.Booster, but predict was actually dispatching to predict.xgboost, which does not have a predcontrib argument. I have to hack the generics by calling xgboost:::predict.xgb.Booster(). Finally, I feel like it worked.


r/rstats • • 2d ago

[Package] hdsbm: Fast inference for Dynamic Stochastic Block Models in R (Rcpp & spectral multi-start)

8 Upvotes

Hi everyone!

As part of my Master's thesis in Statistics, I developed hdsbm, an R package for estimating and simulating discrete-time Dynamic Stochastic Block Models (DSBM).

The Problem & Approach

Temporal block models often suffer from combinatorial explosion and multi-modal likelihood landscapes, making standard local search heuristics prone to getting trapped in sub-optimal local extrema.

hdsbm addresses this by extending a hybrid Classification EM (CEM) approach to the dynamic setting: * Perturbed SVD Multi-Start: Couples deterministic spectral embeddings of the time-averaged network with controlled stochastic perturbations to thoroughly explore the likelihood surface. * C++ Backend: Uses RcppArmadillo to accelerate dyadic reallocation passes and combinatorial greedy sweeps. * Dual Decoding: Provides both pointwise greedy labels and global Viterbi trajectory decoding. * Model Selection: Includes an Integrated Completed Likelihood (ICL) criterion tailored for dynamic graphs.

Quick Example

```r library(hdsbm) data(toy_hdsbm)

Fit model with 5 perturbed spectral restarts

fit <- hdsbm_fit(toy_hdsbm$Y, k = 3, nrep = 5, seed = 123) print(fit)

Model selection via ICL

icl(fit) ```

I would love to hear your feedback on API ergonomics, potential edge cases, or ideas for interesting benchmark scenarios!


r/rstats • • 2d ago

ggbelarus

Thumbnail
github.com
12 Upvotes

Just a very quick vibe-coded ggplot theme. I saw this excellent Economist article (gift link) and was inspired.


r/rstats • • 3d ago

Quirky data native to R

6 Upvotes

hey all,

curious to get some recommendations of some dAta sets native to R, R studio. This is for a graduate visualization class (I know, it seems silly and trivial, but C'est la vie). pretty open ended project, and want to know some options instead of asking Claude


r/rstats • • 3d ago

Static Shiny Dashboards in the Browser with Emscripten-Forge

Thumbnail
emscripten-forge.org
25 Upvotes

You can now publish static dashboard on emscripten-forge and github
You can check an example here: https://emscripten-forge.github.io/r-shiny-template/


r/rstats • • 3d ago

Weird R reference

Thumbnail
5 Upvotes

r/rstats • • 4d ago

I built a reactive terminal UI framework for R

Post image
68 Upvotes

Hi everyone,

I've been working on an R package called termr.

It includes:

- widgets, layouts, events and reactive state

- virtualized data tables with sorting, filtering and search

- lazy table sources and DBI/SQLite workflows

- background R workers with progress and cancellation

- dialogs, tabs, trees, text editing, command palette

- headless testing with testthat

- Windows, Linux, macOS and interactive SSH support

The screenshot is a real order explorer running on 20,000 rows of synthetic data.

A tiny app looks like this:

library(termr)

app(

vertical(

label("Hello from R"),

data_table(mtcars),

button("Quit", on_press = function(event, app) app$exit())

)

) |> run()

The project is MIT licensed and currently at v1.0.0-rc1.

I'd really like feedback from R users.

Also, you can use AI if you want to try coding with this library.

GitHub:

https://github.com/41929424/termr


r/rstats • • 4d ago

⏰ Early Bird pricing for R+AI 2026 ends October 12!

5 Upvotes

Join us for R+AI 2026, November 10–11, the R Consortium's virtual conference exploring the intersection of open-source R and artificial intelligence.

Register by October 12 to save:

- 50% off for students

- Over 30% off for academia and industry

Connect with practitioners, researchers, and industry experts exploring machine learning, large language models in R, AI-assisted coding, real-world applications, and responsible AI.

Two days of talks, workshops, lightning talks, and panels focused on the future of R and AI.

Don't miss the Early Bird deadline!

Register now: https://rconsortium.github.io/RplusAI_website/


r/rstats • • 4d ago

Mixed R and Python workflows in the browser with Emscripten-Forge

Thumbnail
notebook.link
7 Upvotes

It's now possible to use both R and Python in the same notebook, thanks r-reticulate, in the browser:
The article is here: https://emscripten-forge.org/blog/posts/reticulate.html
And the example: https://notebook.link/@DerThorsten/r-reticulate


r/rstats • • 4d ago

Model-Agnostic, Finite-Sample Guaranteed Prediction Intervals for Spatial & amp; Spatio-Temporal Models in R

Thumbnail
cran.r-project.org
0 Upvotes

TL;DR:

Standard spatial models (Kriging, Spatial Random Forests, GAMs) rely on strict Gaussianity or spatial stationarity to estimate uncertainty. Under spatial heteroskedasticity or heavy-tailed noise, empirical coverage systematically falls below nominal 95%. We built spconform, an R package implementing Spatial Conformal Prediction to deliver model-agnostic, distribution-free 1 - α prediction intervals with exact finite-sample coverage guarantees.

  1. The Challenge: Flawed Uncertainty in Spatial Prediction

Geostatistical Kriging and Spatial ML models generate prediction intervals that heavily rely on Gaussian errors and spatial stationarity assumptions. In real-world spatial data (climate modeling, real estate pricing, epidemiology):

  • Spatial Heteroskedasticity: Residual variance fluctuates geographically (e.g., higher volatility in urban centers than rural areas).
  • Heavy-Tailed Noise: Extreme spatial shocks invalidate standard t-statistics and normal approximations.
  • Uncalibrated Spatial ML: Advanced spatial regressors (Spatial Random Forests, Neural Networks) yield accurate point estimates hat(Y)(x) but lack valid, calibrated prediction intervals.
  1. The Solution: Spatial Conformal Prediction (spconform)

Conformal prediction converts point predictions into valid prediction intervals with exact finite-sample guarantees:

`P(Y_new ∈ C(X_new)) ≥ 1 - α`

The spconform package extends split conformal inference to spatial and spatio-temporal domains:

  1. Model Agnostic: Compatible with any spatial regressor (Geostatistical Kriging, Spatial Lag/Error models, Random Forests, XGBoost).
  2. Spatially Adaptive Intervals: Adjusts interval width dynamically based on local spatial residual density (narrower in low-variance zones, wider in high-volatility areas).
  3. Distribution-Free Guarantees: Proves valid$1 - \alpha$coverage without assuming normality, linearity, or spatial stationarity.
  4. Spatio-Temporal Scaling: Handles spatial autocorrelation through localized non-conformity calibration.

3. Minimal Working Example in R

library(spconform)
library(sf)

# 1. Fit your preferred spatial regressor (e.g., Kriging, Spatial RF, GAM)
spatial_mod &lt;- fit_spatial_model(log_price ~ sqft + bedrooms, data = train_data)

# 2. Generate Conformal Prediction Intervals with 95% Finite-Sample Guarantee
conformal_out &lt;- spconform(
  model = spatial_mod,
  calibration_data = calib_data,
  test_data = test_data,
  coords = c("longitude", "latitude"),
  alpha = 0.05,
  method = "spatial_adaptive" # Local spatial variance adjustment
)

# 3. Visualize Spatially Adaptive Uncertainty Map
plot(conformal_out, type = "interval_width")

Open for Discussion & Community Feedback

We are excited to share spconform with the R and Spatial Statistics community!

  • How do you currently handle spatial heteroskedasticity and uncalibrated prediction uncertainty in your spatial workflows?
  • What additional spatial non-conformity metrics or calibration weighting schemes would you like to see integrated?

CRAN : https://cran.r-project.org/web/packages/spconform

github : https://github.com/amjed-droid/spconform


r/rstats • • 5d ago

From Census Blocks to Legal Contiguity: Christopher T. Kenny on R package {geomander}

18 Upvotes

Census blocks, precincts, school districts, and electoral boundaries rarely line up. But researchers still have to match those geographies, fix gaps and overlaps, and represent legal rules about which areas count as contiguous.

In a new R Consortium interview, Christopher T. Kenny (Princeton Data-Driven Social Science) talks about {geomander}, the R package he has developed for that geographic preparation. {geomander} sits alongside {redist} in a typical workflow: clean and connect the spatial data first, then simulate and evaluate alternative plans.

Kenny also describes how widely R is used in political science and voting-rights work, from academic research to journalism and litigation.

Read the interview:

https://r-consortium.org/posts/from-census-blocks-to-contiguous-maps-christopher-kenny-on-geomander/


r/rstats • • 5d ago

Help with identifying a second-order factor in lavaan (2 first-order factors)

1 Upvotes

​

Hi everyone,

I'm working on a CFA in lavaan and having trouble with a second order (higher order) factor.

I want to model Health Behaviour as one higher order latent variable consisting of two first-order latent factors:

test1 =~ item1 + item2 + item3 + item4 + item5

test2 =~ item6 + item7 + item8 + item9 + item10

health_behaviour =~ test1 + test2

The first order factors seem to work reasonably well. However, when I estimate the second order model, I get a very unstable higher order solution.

The resulting Bartlett factor score for health behaviour is also problematic (basically NA for all observations), so It's of no use whatsoever.

Any suggestions?


r/rstats • • 6d ago

Doom generic in R 100%

67 Upvotes

Hey crazy R friends!

My name is Wagner, and I've been working on migrating C/xBase systems to Linux since 1999. I've been working on migrating Doom to Harbour for several years, and with the help of AI, I've managed to make significant progress. Now that I have a higher-level version, I've decided to port this code to other languages ​​like PHP, Python, Java, Node, R, Lua, and I'm working on more. Harbour and C's guidelines for it have made it possible to actually see Doom running in these languages. Below is my contribution to the R scientist community.

https://github.com/vagucs/r_doom

Video:

https://youtu.be/hEJqkEXS944

Hugs
Wagner (vagucs)


r/rstats • • 6d ago

Repeatability graph?

Post image
5 Upvotes

Hi,

I'm using rpt() from the rptR package for my tests, but I can't find any information on how to create this kind of figure. Does anyone have any ideas on how to do it? I'm not looking for a ready-made answer, but at least some resources to help me learn.


r/rstats • • 6d ago

New release of anvl

16 Upvotes

We have released a new version of anvl, which brings fast array computing to R and aims to serve as a basis for implementing costly numerical algorithms natively in R.
It runs on GPU and CPU and has support for autodiff as well!
It has gotten a lot more features, so you can check it out: https://github.com/r-xla/anvl We have also started the process of submitting it (and it's dependencies) to CRAN!


r/rstats • • 7d ago

TOMORROW! 📣 R Core / R Foundation panel discussion: Sustaining R: Investing in the People, Infrastructure, and Community Behind R

43 Upvotes

Hear from Simon Urbanek, Kurt Hornik, and Heather Turner of R Core and the R Foundation about what it takes to keep R healthy for the long term, from strengthening its technical foundations to developing the next generation of contributors and sustaining the institutions behind R.

📅 October 6, 2026

🕛 12 PM PT / 3 PM ET / 8 PM London

Register: https://r-consortium.org/webinars/sustaining-r-investing-in-the-people-infrastructure-and-community.html