如何从"htest"提取数据集在r中使用公式时的对象 [英] How to extract the dataset from an "htest" object when using formula in r

查看:377
本文介绍了如何从"htest"提取数据集在r中使用公式时的对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题是使用公式时如何从"htest"对象中提取数据集. 例如,

The question is how to extract the dataset from an "htest" object when using formula. For example,

library(gginference)
t_test <- t.test(formula = pulse~ gender,  
             data=questionnaire)
t_test$data.name

返回

[1] "pulse by gender"

是否可以提取数据集(在本例中为问卷")?

Is there a way to extract the dataset (in this case "questionnaire")?

推荐答案

无法从t.test()的输出列表中提取数据. t.test()输出的组件代码是这样的:

There is no way that you could extract the data from the list of the output of t.test(). The code for the components of the output of t.test() is this:

rval <- list(statistic = tstat, parameter = df, p.value = pval,
           conf.int = cint, estimate = estimate, null.value = mu,
           alternative = alternative,
           method = method, data.name = dname)
    class(rval) <- "htest"

您可以看到t.test()的输出列表不包含变量.

You can see that the list of the output of t.test() does not include the variables.

这篇关于如何从"htest"提取数据集在r中使用公式时的对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆