r/rstats • • 9h ago

Textmate lives

1 Upvotes

A great editor is key for R, and the OG TextMate had and retains has a surprisingly strong following among R users who love bundles and hate heavy IDEs.

Textmate lives is a reboot.

It has cleared the technical debt, and adding modern features such as built in disjoint selection (cntrl-W), cursor history (cntrl -/+ to smartly move back and forth between jumps/edits) both coming in the next release. Speaking of which it's been getting frequent updates and auto-download is reconnected: You can sub to the beta channel again.

The R bundle has support for modern headings (navigable by symbols menu) and open to more improvements. Check it out. Feedback welcome.

https://github.com/textmatelives/textmate (at releases)

It


r/rstats • • 10h ago

How to use R (R studio) for data wrangling??

Thumbnail reddit.com
0 Upvotes

r/rstats • • 10h ago

How to use R (R studio) for data wrangling??

Thumbnail reddit.com
0 Upvotes

r/rstats • • 1d ago

Trouble running R on positron

6 Upvotes

Been trying to run R on positron. I'm on Windows and have downloaded both but for some reason I'm getting the error message "Cannot execute code because there is no registered runtime for the 'r' language". Not sure what I'm missing. Just spent a couple hours trying to figure it out and can't find any clear answers anywhere so if anyone has any ideas I would be super grateful


r/rstats • • 1d ago

Plotting curves after coxph frailty model and strata()

3 Upvotes

Hello I am asking if anyone is aware of how to draw adjusted cum hazard and survival curves after running a frailty model using coxph. I am using the Surv(start, stop ,event status) framework with gap times. Importantly, I have had to stratify a binary variable as it violated the proportional hazards assumption - using strata(var). The goal is to do curves for the overall sample (showing the two strata), and then separately for each individual variables. I have an interaction and it would be good to plot the hazards of 1 variable versus the actual values of the other variables. Any guidance, particularly code implementation, of this would be very helpful.

I am a clinician and not a statistician, but also not trying to use AI at all as Im against it and dont want to have to use it and then declare it.

I am aware of other setups for example cluster() option for robust standard errors as well as frailtypack, coxme, etc. The curves could be drawn in easily with the cluster() option. However, the research question very much needs a frailty model. Also Ive written out the whole thing based on the frailty findings and Kaplan Meier curves...the findings dont necessarily remain with other modelling options which is a problem.


r/rstats • • 1d ago

How do you decide whether a residual correlation structure (e.g. AR(1)) is necessary in a longitudinal linear mixed-effects model when AIC/BIC and residual diagnostics disagree?

Thumbnail
reddit.com
2 Upvotes

r/rstats • • 1d ago

Rayshader 1.0: Exit the Matrix

Thumbnail tylermw.com
76 Upvotes

r/rstats • • 2d ago

Cox PH assumption Schoenfeld residuals

1 Upvotes

I was reading this site: https://www.datanovia.com/learn/biostatistics/survival-analysis/testing-ph-assumptions about the cox PH assuption, and i ran the code below

library(survival)
library(survminer)

res.cox <- coxph(Surv(time, status) ~ age + sex + ph.ecog, data = lung)
test.ph <- cox.zph(res.cox)

ggcoxzph(test.ph)

On the website they say "survminer’s ggcoxzph() draws, for each covariate, the scaled Schoenfeld residuals against transformed time, with a smoothing spline and a ±2-standard-error band.

Below they also say: "

  • In all three panels the spline is essentially flat and stays inside the band, so there is no pattern with time: the assumption is supported for age, sex (the two-level factor accounts for the two residual bands), and ph.ecog. This matches the non-significant cox.zph() p-values exactly." So everythings seems fine.

I now do this classic comand myself below.

library(survival)
res.cox <- coxph(Surv(time, status) ~ age + sex + ph.ecog, data = lung)
test.ph <- cox.zph(res.cox)

plot(test.ph[1])

abline(h = res.cox$coefficients[1])

And I get the image below where the line seems not to inside the band, is this because I've not plotted the scaled Schoenfeld residuals against transformed time? And what does even transformed time mean in this setting? If I used this plot I would be debating myself quite a bit if the PH assumption hold.


r/rstats • • 2d ago

Hello from the Washington DC R Conferencehttps://i.imgur.com/sZWfmgK.jpeg

0 Upvotes

r/rstats • • 2d ago

Cove: an open-source IDE where R, Shiny and Python (via reticulate) run on a prebuilt software stack

0 Upvotes

I've been building Cove, a development environment for scientific applications.

  • R, Python, Julia and Rust from the same software stack, with Python inside R through reticulate
  • Thousands of packages already built and shared by every project
  • Code, consoles, plots and an AI agent in one workspace
  • Every project runs at its own address; work is saved every 30 minutes and any version can become a container image
  • MIT-licensed: install it on your own servers and point the agent at your own Anthropic or OpenAI key

Install on Linux: `curl -fsSL https://ndexr.io/install.sh | sh`

Site: https://ndexr.io Source: https://github.com/fdrennan/cove

I'd value blunt feedback on what's missing for your workflow.


r/rstats • • 3d ago

White Noise in SARIMA residuals

Thumbnail reddit.com
6 Upvotes

r/rstats • • 4d ago

Why is coxph choosing 2 as reference from survsplit data

7 Upvotes

Hi

I'm a currently a beginner with survSplit and I was curious why it seems like coxph chooses 2 as reference here from my survsplit data in my MRE below:

library(survival)
library(tidyverse)

lung <- lung

lung <- lung %>% 
  mutate(status = if_else(status == 2, 1,0)) %>% 
  mutate(ph.ecog = case_when(ph.ecog == 0 ~ 0,
                             ph.ecog == 1 ~ 1,
                             TRUE ~ 2)) %>% 
  mutate(ph.ecog = factor(ph.ecog))


lung200 <- survSplit(Surv(time,status) ~ sex + age + ph.karno + ph.ecog, 
                     data = lung, cut = c(200), episode = "time_group")


coxph(Surv(time,status) ~ ph.ecog:strata(time_group) + sex + age + ph.karno, 
      data = lung200 )

r/rstats • • 4d ago

Unpacking during assignment in R

1 Upvotes

R indeed already has this with %<-℅ from zeallot package but I don't think you can apply it into assigning variables inside for loops like Python did with its for i, j in iter_item. Same goes with unpack from 'wrapr' package. It would be so incredible if R has good unpacking functionality so that I would avoid writing similar to

for (i in seq_along(iter_item)) {
  x <- iter_item[[i]]
  cat(i, ". ", x, "\n", sep = "")
}

every time and instead, we'll do something like:

for (unpack(x, i) in enum(iter_item)) {
  cat(i, ". ", x, "\n", sep = "")
}

It's a bad syntax but as long as unpacking is involved, I'm fine with it. Maybe I missed other packages that does the job.


r/rstats • • 6d ago

Plotted 60 days of my quantile forecasts against what happened. The 80% band only held 66%

11 Upvotes

Forecasting a daily price with quantreg::rq() at tau 0.1 n 0.9, then plotting the band vs actuals in ggplot every week.

  • In sample the 80% band covers about 79%
  • Last 60 days: 66%
  • Adding a 20 day rolling sd as a predictor got it to 70
  • Refitting weekly instead of monthly changed nothing

I've seen conformal quantile regression mentioned a few times. Is that what ppl use in R for this, and is there a package youd recommend?


r/rstats • • 7d ago

The major S7 version 1.0 has been released!

Thumbnail
opensource.posit.co
65 Upvotes

Finally, S7 has reach its mature v1.0.0 release, and I have been waiting for this as an S7 user. It has the capabilities of S3 and S4, but more robust with types and classes and arguably less stupid (see more in this blog), albeit the complexity. R's Lisp-y mechanics never fails to amaze me (also sometimes a pain), something that is missing in Python, which is the reason why R has multiple classes (for better or for worse, your call), and also because of this, I like the new changes in S7, including the walrus := operator (I find this redundant at first but changed my mind later), its S4 inheritance semantic — now, I can work with legacy S4 codes with less pain (or so I hope), and its method dispatch mechanics for unary/binary operators. There are many more in this release, yes, but those are the things I like the most, but those are the things that caught my attention.

Though by this release, it somehow broke our package and we have to fix it until Dec. 11 😑, but it's no biggie I suppose.


r/rstats • • 8d ago

Preferred libraries for Bayesian Optimization

11 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 • • 9d ago

Swirl: Lessons do not load. Help

Post image
3 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 • • 10d ago

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

16 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 • • 10d ago

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

5 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 • • 10d 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 • • 10d ago

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

7 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 • • 10d ago

Default app issue

Thumbnail reddit.com
3 Upvotes

r/rstats • • 11d 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
27 Upvotes

r/rstats • • 11d ago

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

Thumbnail
github.com
0 Upvotes