How can one easily extract the full list that is generated by the t.test in excel? This is suboptimal:

write.matrix(t.test.res, file="ttest.csv", sep="\t")

How can one easily extract the full list that is generated by the t.test in excel? This is suboptimal:

write.matrix(t.test.res, file="ttest.csv", sep="\t")

The broom package can help with organizing such output.

```
A <- rnorm(20,2,1)
B <- rnorm(20,2.5,1)
T_result <- t.test(A,B)
T_result
#>
#> Welch Two Sample t-test
#>
#> data: A and B
#> t = 0.39155, df = 33.815, p-value = 0.6978
#> alternative hypothesis: true difference in means is not equal to 0
#> 95 percent confidence interval:
#> -0.5330646 0.7874344
#> sample estimates:
#> mean of x mean of y
#> 2.488024 2.360839
Tidy <- broom::tidy(T_result)
Tidy
#> # A tibble: 1 x 10
#> estimate estimate1 estimate2 statistic p.value parameter conf.low
#> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 0.127 2.49 2.36 0.392 0.698 33.8 -0.533
#> # ... with 3 more variables: conf.high <dbl>, method <chr>,
#> # alternative <chr>
```

^{Created on 2019-07-07 by the reprex package (v0.2.1)}

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.