[R] Did behavior of "paired" argument in t.test() change?
Peter Dalgaard
pd@|gd @end|ng |rom gm@||@com
Wed Nov 5 13:28:09 CET 2025
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 using r-project.org> wrote:
>
> В Tue, 4 Nov 2025 11:22:57 -0600
> Robert Baer via R-help <r-help using 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 using 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 using cbs.dk Priv: PDalgd using gmail.com
More information about the R-help
mailing list