You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I encounter the same error, when data are in wide format, the t.test works,
but when we put data in vertical format, then the t.test gives an error, as the example below:
x1<- c(4.71, 6.66, 5.01, 4.6, 3.98)
x2<- c(5.42, 7.1, 5.52, 6.05, 6.23)
t.test(x1, x2, paired=TRUE)
#> #> Paired t-test#> #> data: x1 and x2#> t = -3.1096, df = 4, p-value = 0.03589#> alternative hypothesis: true mean difference is not equal to 0#> 95 percent confidence interval:#> -2.029145 -0.114855#> sample estimates:#> mean difference #> -1.072
data<-data.frame(
group= rep(c("x1", "x2"), each= length(x1)),
values= c(x1, x2)
)
t.test(values~group, data=data, paired=TRUE)
#> Error in t.test.formula(values ~ group, data = data, paired = TRUE): cannot use 'paired' in formula method
@ddsjoberg mentioned that this could be solved with ... |> utils::modifyList(list(paired = NULL), keep.null = FALSE)
but this gives me an error; as copied below:
utils::modifyList(list(paired=NULL), keep.null=FALSE)
#> Error in utils::modifyList(list(paired = NULL), keep.null = FALSE): argument "val" is missing, with no default
Created on 2024-06-18 with reprex v2.1.0
I would appreciate if someone could help me solve this problem, which appeared I believe with some updating of packages (the t.test function with paired data worked before normally)
@joanbirules thanks for the post. Can you update your post to include the call to the cardx t.test function. Also, can you please use the reprex package to create your reproducible example. This ensures the isolation of your environment when illustrating the issue.
@ddsjoberg I have used the reprex to report the code parts, but I do not know what you mean by including the cardx t.test function, the function is already there isn't it?
This is the GitHub repo for the {cardx} R package. I don't think you're using that package, right? The best place to ask for help would be stackoverflow for a generic R function
What happened?
In this threat, @ddsjoberg commented on a bug with the paired/unpaired tests, giving an error when paired =F or T is entered into the t.test function:
#56 (comment)
I encounter the same error, when data are in wide format, the t.test works,
but when we put data in vertical format, then the t.test gives an error, as the example below:
Created on 2024-06-18 with reprex v2.1.0
@ddsjoberg mentioned that this could be solved with ... |> utils::modifyList(list(paired = NULL), keep.null = FALSE)
but this gives me an error; as copied below:
Created on 2024-06-18 with reprex v2.1.0
I would appreciate if someone could help me solve this problem, which appeared I believe with some updating of packages (the t.test function with paired data worked before normally)
thank you very much,
Joan
sessionInfo()
Relevant log output
Code of Conduct
Contribution Guidelines
Security Policy
The text was updated successfully, but these errors were encountered: