1

我正在使用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不是开源的。谢谢

4

3 回答 3

4

use asreml's controlling stuff - the asreml.control() function control many aspects of asreml call, you can provide its arguments directly to asreml call, in you case you want to have trace=F, so e.g.

library(asreml)
dat <- data.frame(y=rnorm(20), x=seq(1,20))
ex.asr <- asreml(y ~ x, data=dat, trace=F)
于 2014-01-26T21:34:07.833 回答
2

如果(看起来)那是正在被print()编辑的东西,您可以使用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
于 2012-05-30T18:44:00.450 回答
2

如果asreml-R设计得很好,那么suppressMessages()围绕命令应该可以工作。否则我会建议

sink("junk.txt")
## asreml command
sink()
于 2012-05-30T18:44:14.597 回答