Is it possible to run a t.test
from piping
operators?
I tried to find the answer to this, but most of the questions around this topic look at d
We can place it inside summarise
as a list
d %>%
summarise(ttest = list(t.test(amount ~ group, var.equal = TRUE)))
and if we need to extract only the pvalue, this can be done
d %>%
summarise(pval = t.test(amount ~ group, var.equal = TRUE)$p.value)
Or we can place it inside the {}
and then do the t.test
d %>%
{t.test(.$amount ~ .$group, var.equal = TRUE)}
Or without the braces by specifying the data
for the formula method
d %>%
t.test(amount ~ group, data = ., var.equal = TRUE)
EDIT: based on @hpesoj626's comments