r/rstats • • 1d ago

Preferred libraries for Bayesian Optimization

8 Upvotes

I've been trying to move a Bayesian optimization setup I made in Python via Scikit Learn & Optuna over to R and I found a couple different ways to do it.

The first results I found were tutorials using caret and rBayesianOptimization packages. Upon digging further I found out about Tidymodels and the whole system with Parsnip + Dials seems to be similar to what I was using and more recently updated.

Wanted to ask if there was a significant difference in performance between these different Bayesian optimization methods, and if there is a package I haven't found yet that I really should be using for this. My guess is that I'm overthinking it and that if I like Tidyverse then I should use Tidymodels.

The specific models I'm optimizing are survival or time-to-event models. I initially made these via scikit-survival + lifelines but I've been moving to the survival + ranger R packages so I can run them with the MICE multiple imputation package.


r/rstats • • 2d ago

Looking for online courses or books to learn statistical analysis in R for social sciences

11 Upvotes

Hi everyone!

I have a bachelor's and a master's degree in Political Science, and I'm looking for a beginner-friendly online course or book that teaches quantitative methods using R, specifically for social research (i.e. social statistics with R for sociology, political science, and the social sciences more broadly).

I'm not looking for an online course or book that covers the entirety of R for every possible statistical method, as that would be far too broad. I'd like something focused on quantitative methods for social sciences, starting from the basics. I had a statistics class, but unfortunately it was just theoretical, with no software involved. I assume the online course or book would include, for example:**

• descriptive statistics

• hypothesis testing

• most importantly, regression analysis using R.

Any advice?


r/rstats • • 2d ago

Swirl: Lessons do not load. Help

Post image
2 Upvotes

Hi. Im trying to learn R with Swirl, but from lesson 10 onwards I get the error shown in the screenshot.

I am super confused. I tried searching the directory but found no folder named "AppData" inside "Usuario". The apps "R-4.6.2-win" "R_Programming_E" and company are all in my Downloads folder,

I dont get why its trying to search a folder that never existed and never told me to create.

I dont know if the solution is obvious and im just too tired, or if this s a bug im unaware of.

Can someone help me?

Thank you for reading this far


r/rstats • • 2d ago

I just published rairai on CRAN! It’s an MCP server built to speed up R package development.

0 Upvotes

Hi folks! If you use AI coding agents to develop R packages, you might find rairai useful. It’s an MCP server that uses Tree-sitter to give agents a structured view of an R package. For example, an agent can find where a function is defined and used, check what the package imports, or look up a help page. Think of it as a language server designed for AI agents.

I built rairai out of frustration with a few things I kept seeing in my own work. I’d watch an agent burn tokens searching for a function and fill its context with unrelated code along the way. Sometimes it would miss that a function was already imported and add namespace prefixes where they weren’t needed. Other times it would guess what an argument did or what a function returned instead of checking the docs, and miss an important side effect.

The idea behind rairai is simple: give agents easy access to the same information I’d look up myself. Language servers are built around what an editor needs. I built `rairai` around the questions I want an agent to ask, like “What should I check before changing this function?” The goal is to get the relevant information in one call without filling the context with unrelated code.

You can find it on CRAN, and the source is on GitHub. If you try it on one of your own packages, I’d love to hear what worked and what you’d change!


r/rstats • • 3d ago

Shipping R-Powered Drug Discovery Models as Apps on an Enterprise AI/Data Platform

4 Upvotes

Most R machine learning models for drug discovery never leave the researcher’s laptop. Getting them into a governed, production AI app is a different challenge.

Now on the R Consortium YouTube channel: Chanin Nantasenamat, PhD (Lead Developer Advocate, Snowflake) walks through a case study from R+AI 2026, taking R-based models from exploratory lab code to production on an enterprise data platform. Reproducible preprocessing, molecular feature engineering, training and scoring, version control, containers, and a Streamlit frontend so scientists can query predictions without touching code, plus secure deployment, keeping proprietary chemistry in-house, monitoring, and cost control at scale.

"From Lab to Production: Shipping R-Powered Drug Discovery Models as Apps on an Enterprise AI/Data Platform"

https://youtu.be/xX3TxlrkAV8


r/rstats • • 3d ago

Is AI there yet?

0 Upvotes

I have only used the free tiers of the most popular AI chats for some code generation. And it takes at least 50 whips, before an acceptable output.

Can the newest, paid versions really work from start to finish on their own? Or are the people on Twitter having an AI psychosis?


r/rstats • • 3d ago

Default app issue

Thumbnail reddit.com
3 Upvotes

r/rstats • • 4d ago

Long time ago i made a simple script to animate a maze generation process, it was well receiveid, but i set to private the repo and lost all my stars. Decided to give a lift up. Today in the era of agents this is trivial, but it was a great archieviement for me at the time. So here its a nice gif.

Post image
25 Upvotes

r/rstats • • 4d ago Bravo

cuplyr: dplyr on an NVIDIA GPU

54 Upvotes

I've been building cuplyr, a dplyr backend for NVIDIA GPUs built on RAPIDS cuDF. It works pretty much like dbplyr. You can upload a data frame with tbl_gpu(), write normal dplyr code and collect() or compute() the results. On a 10-million-row pipeline it runs about 40x faster than dplyr on my machine. But depends a lot on different tasks.

It's still experimental, and I'm sure there are plenty of cases I haven't hit yet. If you try it on dplyr code you already have and something would either break or run extremely slowly. I would appreciate a bugreport! Just remember to set options(cuplyr.fallback = "warn") as the default behaviour is currently to fall back to the CPU quietly.

You don't need your own GPU to try it. This Colab notebook installs it on a free GPU, and then you can paste in your own code: https://colab.research.google.com/github/bbtheo/cuplyr-material/blob/main/notebooks/try-cuplyr-colab.ipynb

If you would want to install it on your own machine you need Linux, an NVIDIA RTX 20-series card or newer, and CUDA 12.2+.

Most of the code was written with a multi-agent Claude setup, using dplyr's own test suite to check the results extensively.

Repo: https://github.com/bbtheo/cuplyr

TLDR: dplyr on a GPU


r/rstats • • 4d ago

rray: An array focused R package, inspired by NumPy

67 Upvotes

After SEVEN LONG YEARS I am thrilled to be able to say that rray is back on CRAN!

rray is an array focused R package (not data frames, for once!), extremely inspired by NumPy.

rray.r-lib.org/index.html

- Broadcasting
- Combining and splitting
- Flexible slicing
- Long vectors
- And so much more!

Broadcasting is the idea of applying the tidyverse recycling rules (length 1 recycles to any other length) to all axes of an array. It allows you to, say, add a 2x1 array to a 1x3 array in a meaningful way, with a 2x3 result. Read about it in our broadcasting vignette:

https://rray.r-lib.org/articles/broadcasting.html

rray has a very powerful (and fast!!) family of functions for combining and splitting arrays. Like everything else in the package, they support broadcasting, allowing you to combine in ways that rbind() and cbind() don't allow:

https://rray.r-lib.org/articles/toolkit.html#combining

rray has "long vector" support throughout the entire package, meaning that it works with arrays longer than ~2 billion elements with no issues.

Array terminology can be highly confusing, so rray documents precise definitions exactly once, and uses them throughout the package. rray is intentionally very consistent! Once you learn one concept it tends to translate well to the other functions in the package:

https://rray.r-lib.org/articles/terminology.html

rray is an interesting experiment for me. It was created almost entirely from my phone using Claude's and Codex's remote-control features. But it is not slop! I personally vouch for every line of code, and ruthlessly interrogated each one. As an example, here's the development of `rray_if_else()`. After planning and creating with Claude, I followed up with ~30 corrections to forge it into something I felt met my high quality bar (I am a maintainer of both dplyr and vctrs, so my standard is extremely high). The result is that rray's R and C code don't "feel" AI written to me.

https://github.com/r-lib/rray/pull/137

I've created a neat visualization that tracks rray's development over time. You can see every conversation, in full, paired with the PR and function it generated. It also shows approximate cost at API prices (though I used a subscription).

https://davisvaughan.github.io/rray-timeline/


r/rstats • • 4d ago

Expired GP key for CRAN-R Debian packages

8 Upvotes

Hi,

The GPG key used to sign Debian packages for CRAN-R has expired:

LANG=en gpg --list-keys 95C0FAF38DB3CCAD0C080A7BDC78B2DDEABC47B7
pub   rsa4096 2021-11-16 [C] [expired: 2026-11-15]
      95C0FAF38DB3CCAD0C080A7BDC78B2DDEABC47B7
uid           [ expired] Johannes Ranke <johannes.ranke@jrwb.de>

Can anyone ask around on the r-sig-debian mailing-list?


r/rstats • • 5d ago

Need advice: Using RStudio for my master’s thesis data analysis and making sure I’m doing things correctly

16 Upvotes

Hi everyone!
I’m currently working on the statistical analysis for my master’s thesis in nutrition science, and I’d really appreciate some advice from people experienced with R and research data analysis.

My study involves survey data from over 1,300 participants, including demographic variables, dietary frequency data, knowledge questions, and Likert-scale responses related to attitudes and behaviors.
I’ve studied statistics during my degree, but applying statistical methods to a real dataset feels quite different from learning them in class.

I’ve been using RStudio and AI to help with coding, data cleaning, statistical tests, and visualizations. While AI has been incredibly helpful, I sometimes worry about whether the suggested methods are statistically appropriate, even when the code runs without errors.

I genuinely want to understand what I’m doing rather than simply copying and running code, especially since the results will be part of my thesis.
For those who use R in academic research:
How do you verify that your statistical analyses and R code are correct?

What resources helped you bridge the gap between statistical theory and practical analysis?
Do you have any advice for using AI responsibly when writing or reviewing R code?
I’d really appreciate any guidance, resources, or personal experiences.

Thank you!


r/rstats • • 5d ago

Will R development move to GitHub?

49 Upvotes

It feels a bit surprising that core R is still developed on SVN when almost its entire package ecosystem relies on Git and GitHub. Are there any plans to eventually migrate R to GitHub? Moving over could really attract more contributors.


r/rstats • • 4d ago

erro fatal no Rstudio quando tento puxar um dataframe

Thumbnail reddit.com
0 Upvotes

r/rstats • • 4d ago

Initial VuPy release: CuPy-like GPU array library backed by vulkan. any and all feedback is preferred.

Thumbnail
github.com
0 Upvotes

r/rstats • • 5d ago

[Q] What would be the best approach to inter-rater reliability for temporally annotated events?

Thumbnail reddit.com
1 Upvotes

r/rstats • • 5d ago

Non metric multidimensional scaling (NMDS) question !

Post image
2 Upvotes

r/rstats • • 9d ago

mascot 0.1.0 on CRAN: animated characters for Shiny apps and Quarto pages

Post image
23 Upvotes

mascot 0.1.0 is now on CRAN. It puts a small character, drawn in code, into your Shiny app. You set its mood and status from the server, and it gives a short wiggle when the state changes.

For Shiny specifically:

# UI
mascot("helper", mood = "idle", status = "Ready when you are", placement = "inline")
# server, when the state changes
update_mascot("helper", mood = "worried", status = "Two dates need a look")

- Works inside modules, golem and rhino-style apps (`mascot_examples()` has one of each, plus a form check and a long task)

- `update_mascot()` also shows a speech bubble or plays a nod or wave

- `mascot_popup_menu()` makes the mascot a button with a menu; the choice comes back as `input$<id>_menu`, and it works with the keyboard and screen readers

- Floating in a corner (minimisable) or inline in the page

- Follows your `bslib` theme or your own brand colours, light and dark mode

- Everything ships with the package, no CDN, so it works offline; reduced motion is honoured

- `mascot::mascot_studio()` lets you try every argument and copy the code

Install: `install.packages("mascot")`

Docs: https://insightsurge.github.io/mascot/

Source: https://github.com/insightsurge/mascot

Some parts are experimental in 0.1.0 (Knurl, Neer, the studio, custom character files). I'd like to hear how it fits into your apps and what's missing.


r/rstats • • 8d ago

How do you plot calibration for daily range forecasts over time in ggplot?

4 Upvotes

Have about 120 days of daily forecasts for a price series. each day has a forecast median, an 80% interval and the actual close. i want to show two things clearly:

  1. how taken the actual landed inside the 80% band, and whether that changes over time
  2. whether the misses cluster on certain kinds of days(high vol)

right now i have a geom_ribbon for the band with geom_point for the actuals, plus a separate bar chart of hit rate by month. it works but feels clunky and nobody gets it on first look

any better ways to show coverage time? a rolling coverage line? some package i don't know about? happy to share code if useful


r/rstats • • 9d ago

Free Beginner-Friendly R Programming & Computational Statistics Course (3 Weeks)

25 Upvotes

Hi everyone!

I'm from National Tsing Hua University in Taiwan, and I'd like to share a beginner-friendly R programming course we're offering on FutureLearn.

Data Science for Business Analytics: Introduction to Computing

The course covers R programming, basic statistics, data visualisation, simulations, and bootstrapping through practical activities and real-world datasets.

Course details:

  • Free to learn: Course materials are released weekly, with free access limited to 3 weeks. Certificates and extended access require a paid upgrade.
  • Duration: 3 weeks, approximately 5 hours per week
  • Format: Fully online and taught in English
  • Level: Beginner-friendly; no prior programming experience required

If you're new to R or interested in computational statistics, this might be a useful starting point.

Course link:
https://www.futurelearn.com/courses/data-science-for-business-analytics-introduction-to-computing


r/rstats • • 10d ago

Remedy for statistically significant interaction term in Schoenfeld residual (programming in R) [thesis]

5 Upvotes

Dear all!

I am conducting a Cox proportional hazards analysis and tested the proportional hazards assumption using Schoenfeld residuals. Two interaction terms between predictors showed statistically significant results, suggesting that these effects may vary over time. I am therefore unsure which approach would be most appropriate in R to address this.

Would tt() be suitable in this case? Would it work for interaction terms?

Initially I was thinking of tmerge(), but that doesn't work because this would only work if it is the treatment, right? (although the interaction is between treatment group and an intake variable).

I initially also thought of using strata(), but I guess that's only for categorical variables?

I would be very grateful for any advice on how to handle this appropriately in R, and what remedy there is. Recommendations for relevant literature would also be very welcome.


r/rstats • • 11d ago

commons: Trustworthy data agents

Post image
20 Upvotes

Simon here, an engineer at Posit. We recently released commons, an open source R (and Python) framework for building trustworthy data agents. commons agents can reach directly for analysis code that you already trust from R packages, Quarto docs, Shiny apps, and database views.

https://posit-dev.github.io/commons/


r/rstats • • 11d ago

Can Existing Local Shiny Apps Be Deployed Through Dataiku Without Using Its Low-Code Features?

1 Upvotes

Our company uses Dataiku, and I'm exploring whether it could serve as a deployment platform for several R Shiny applications I've already developed and currently run locally.

I'm not interested in Dataiku's no-code or low-code development capabilities. My goal is simply to deploy my existing Shiny applications so that other employees can access them through a web browser.

Unfortunately, we don't have access to Shiny Server, Posit Connect, or shinyapps.io.

I've come across several Dataiku articles highlighting its deep integration with R and support for web applications built using frameworks such as Shiny, Dash, and Bokeh.

https://doc.dataiku.com/dss/latest/R/index.html
https://doc.dataiku.com/dss/latest/webapps/shiny.html

I have a few questions:

  1. Deployment feasibility: Can an existing, fully functional R Shiny application be deployed directly through Dataiku without substantially modifying its code?
  2. R package dependencies: My applications depend on numerous R packages. Can these be installed within Dataiku, or would IT administrator privileges be required?
  3. Deployment process: How straightforward is the deployment process? Can I upload my existing app.R file and supporting files, configure dependencies, and publish the application?
  4. Licensing and permissions: Does hosting Shiny applications require additional Dataiku licenses, plugins, or administrative configuration?

When running these applications locally, I've generally been able to install R packages without administrator privileges. I'm particularly interested in whether Dataiku offers similar flexibility.

Has anyone successfully deployed existing R Shiny applications through Dataiku? How does the experience compare with using a dedicated Shiny hosting platform?


r/rstats • • 11d ago

Remedy for statistically significant interaction term in Schoenfeld residual (programming in R) [thesis]

Thumbnail reddit.com
2 Upvotes