簡體   English   中英

在 asreml-R 中擬合模型時隱藏信息

[英]Hiding information when fitting model in asreml-R

我正在使用asreml-R包進行分析。 每當我存儲擬合模型對象時, asreml-R都會提供一些我想隱藏的額外信息。 請參閱以下代碼和信息:

library(asreml)
dat <- data.frame(y=rnorm(20),x=seq(1,20))
ex.asr <- asreml(y ~ x, data=dat)

asreml(): 3.0.1 Library: 3.01gl IA32  Run: Wed May 30 13:26:44 2012

     LogLik         S2      DF
    -11.3850      0.7691    18  13:26:44
    -11.3850      0.7691    18  13:26:44

Finished on: Wed May 30 13:26:44 2012

LogLikelihood Converged 

如果您幫助隱藏這些額外信息,我將不勝感激。 請記住asreml-R不是開源的。 謝謝

使用 asreml 的控制內容 - asreml.control()函數控制 asreml 調用的許多方面,您可以將其參數直接提供給 asreml 調用,如果您想要trace=F ,例如

library(asreml)
dat <- data.frame(y=rnorm(20), x=seq(1,20))
ex.asr <- asreml(y ~ x, data=dat, trace=F)

如果(看起來)是print() ed的東西,您可以使用capture.output()將其下沉到臨時文件。

下面是一個例子:

plot(rnorm(99))

capture.output({
    lapply(1:4, function(X) abline(v=20*X))
}, file = tempfile())

## Here's the output that was sunk by `capture.output()`
## (wrapping the call in `suppressMessages()` won't get rid of those "NULL"s)
lapply(1:4, function(X) abline(v=20*x))
[[1]]
NULL

[[2]]
NULL

[[3]]
NULL

[[4]]
NULL

如果asreml-R設計得很好,那么在命令周圍放置suppressMessages()應該可以工作。 否則我會建議

sink("junk.txt")
## asreml command
sink()

暫無
暫無

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

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