MYaseen208
MYaseen208

Reputation: 23908

Hiding information when fitting model in asreml-R

I'm using asreml-R package for my analysis. Whenever I stored a fitted model object asreml-R gives some extra information which I want to hide. See the code and the information below:

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 

I would highly appreciate if you help to hide this extra information. Remember that asreml-R is not an open source. Thanks

Upvotes: 1

Views: 927

Answers (3)

szymekD
szymekD

Reputation: 71

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)

Upvotes: 4

Josh O&#39;Brien
Josh O&#39;Brien

Reputation: 162401

If (as it appears) that is something that is being print()'ed, you can use capture.output() to sink it to a temp file.

Here's an example:

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

Upvotes: 2

Ben Bolker
Ben Bolker

Reputation: 226532

if asreml-R is well designed then putting suppressMessages() around the command should work. Otherwise I would suggest

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

Upvotes: 2

Related Questions