簡體   English   中英

如何在R中拉出函數輸出的特定組件?

[英]How do I pull out a specific component of the output of a function in R?

我正在使用t.test()函數。 輸出有一個組件“p.value”,我想直接訪問。 例如,我希望能夠將此p.value附加到列表中。

非常感謝您的建議。

t.test的返回值只是一個列表:

t.test(runif(10))$p.value
# [1] 0.0001406559

此外,以下是您可以提取的其他內容:

names(t.test(runif(10)))
# [1] "statistic"   "parameter"   "p.value"     "conf.int"    "estimate"    "null.value" 
# [7] "alternative" "method"      "data.name"  

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM