Dear List,

I am trying to run a mixed model which, on the R console, prints output as follows:

[1] "Marker"
[1] "perm no."
[1] NA
Linear mixed model fit by REML
Formula: peg.no.prm ~ 1 + (1 | family/f)
  Data: modeldf
 AIC  BIC logLik deviance REMLdev
3119 3134  -1555     3112    3111
Random effects:
Groups   Name        Variance Std.Dev.
f:family (Intercept)   0.0     0.000
family   (Intercept)   0.0     0.000
Residual             178.5    13.360
Number of obs: 388, groups: f:family, 73; family, 60

Here 'Marker' is one of 426 markers, and 'perm.no' is one of 10,000 permutations of variance for each marker. Each time R begins with a new marker column, it prints 'Marker', and for each permutation it prints a number from 1 to 10000 (it hasn't here, but even 'NA' tells me where one data block begins and another ends-- MUCH easier for eyeballing).

Of course, since at the end, I will have 426*10000 blocks of data, the console doesn't handle it and I tried printing out to a text file (.txt) using capture.output().

The problem with this is that in the text file, my labels ('Marker' and 'Perm no.') aren't printed (since the capture command only uses output from summary(*model*). This leaves me with about 4 million blocks of output (hypothetically) and with no way of telling where one marker ends and the next begins. Eyeballing this will take years.

Is there a way to therefore produce labeled output while writing to a text file?

Thanks a lot for any suggestions that might help,

Aditi

---------------------------------------------------------
Code for a test file with 10 markers:


model<-read.table(".......)

modeldf<-data.frame(model)

modeldf[2:13]<-lapply(modeldf[2:13],factor)
colms<-(modeldf)[4:13]   ## ten marker columns
se<-c(1:10000)

peg.no<-(modeldf)[,14]

library(lme4)


for(f in colms)
{
print("Marker")
{
for( i in 1:10000)
{
print("perm no.")
print(se[i])
{
peg.no.prm<-sample(peg.no, length(peg.no))
try(fit5<-lmer(data=modeldf, peg.no.prm~1 + (1|family/f)))
print(summary(fit5))
capture.output(fit5, file="testperm5.txt", append=T)
}}}
}


The data files are at:


<http://www.4shared.com/file/131980362/460bdafe/Testvcomp10.ht
ml> (excel)
http://www.4shared.com/file/131980512/dc7308b/Testvcomp10.html
(txt)


----------------------
A Singh
aditi.si...@bristol.ac.uk
School of Biological Sciences
University of Bristol

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to