Ivan Krylov
2025-Nov-04 17:40 UTC
[R] Did behavior of "paired" argument in t.test() change?
? Tue, 4 Nov 2025 11:22:57 -0600 Robert Baer via R-help <r-help at r-project.org> ?????:> Errorin t.test.formula(value ~ time, data = data_long, paired > TRUE) : > cannot use 'paired' in formula methodThis was changed in R-4.4.0: https://bugs.r-project.org/show_bug.cgi?id=14359 The news item (see news(grepl('paired', Text))) recommends the use of Pair(x1, x2) ~ 1 instead of the 'paired' argument. A further fix is currently in R-devel (but not R-patched): without it, Pair(x1, x2) does not handle the 'subset' argument. -- Best regards, Ivan
Peter Dalgaard
2025-Nov-05 12:28 UTC
[R] Did behavior of "paired" argument in t.test() change?
Yes. Of course, Pair() requires the data to be in wide format. It's been a while (although not so long ago as some of the other things I cannot remember...) but I think the reason was that the ...y~g, paired=TRUE... format was considered too brittle with respect to sort order and subsetting. -pd> On 4 Nov 2025, at 18.40, Ivan Krylov via R-help <r-help at r-project.org> wrote: > > ? Tue, 4 Nov 2025 11:22:57 -0600 > Robert Baer via R-help <r-help at r-project.org> ?????: > >> Errorin t.test.formula(value ~ time, data = data_long, paired >> TRUE) : >> cannot use 'paired' in formula method > > This was changed in R-4.4.0: > https://bugs.r-project.org/show_bug.cgi?id=14359 > > The news item (see news(grepl('paired', Text))) recommends the use of > Pair(x1, x2) ~ 1 instead of the 'paired' argument. A further fix is > currently in R-devel (but not R-patched): without it, Pair(x1, x2) does > not handle the 'subset' argument. > > -- > Best regards, > Ivan > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide https://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.-- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Office: A 4.23 Email: pd.mes at cbs.dk Priv: PDalgd at gmail.com