summary(mtcars$mpg) -> a
t.test(mtcars$mpg) -> b
a
#> Min. 1st Qu. Median Mean 3rd Qu. Max.
#> 10.40 15.43 19.20 20.09 22.80 33.90
str(a)
#> 'summaryDefault' Named num [1:6] 10.4 15.4 19.2 20.1 22.8 ...
#> - attr(*, "names")= chr [1:6] "Min." "1st Qu." "Median" "Mean" ...
b
#>
#> One Sample t-test
#>
#> data: mtcars$mpg
#> t = 18.857, df = 31, p-value < 2.2e-16
#> alternative hypothesis: true mean is not equal to 0
#> 95 percent confidence interval:
#> 17.91768 22.26357
#> sample estimates:
#> mean of x
#> 20.09062
str(b)
#> List of 10
#> $ statistic : Named num 18.9
#> ..- attr(*, "names")= chr "t"
#> $ parameter : Named num 31
#> ..- attr(*, "names")= chr "df"
#> $ p.value : num 1.53e-18
#> $ conf.int : num [1:2] 17.9 22.3
#> ..- attr(*, "conf.level")= num 0.95
#> $ estimate : Named num 20.1
#> ..- attr(*, "names")= chr "mean of x"
#> $ null.value : Named num 0
#> ..- attr(*, "names")= chr "mean"
#> $ stderr : num 1.07
#> $ alternative: chr "two.sided"
#> $ method : chr "One Sample t-test"
#> $ data.name : chr "mtcars$mpg"
#> - attr(*, "class")= chr "htest"
Created on 2020-08-22 by the reprex package (v0.3.0)