From: Jonathan Williams <jonathan.williams_at_pharmacology.oxford.ac.uk>

Date: Mon 09 Oct 2006 - 16:12:27 GMT

x1[x0]=NA

dat=data.frame(y1,x1)

result=try(lm(y1~x1, na.action=na.fail, data=dat),T); print(result) x1=x2; dat2=data.frame(x1)

if (grep('Error',result)<1) cumulator=cumulator+predict(result,x2) }

R-help@stat.math.ethz.ch 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. Received on Tue Oct 10 02:21:27 2006

Date: Mon 09 Oct 2006 - 16:12:27 GMT

if grep('Error', result)<1 #and so choose not use the result

set.seed(1)

cumulator=rep(0,100)

for (i in 1:100){

y1=rnorm(100) x0=rbinom(100,1,0.02) x1=rbinom(100,1,0.5) x2=rbinom(100,1,0.5)

x1[x0]=NA

dat=data.frame(y1,x1)

result=try(lm(y1~x1, na.action=na.fail, data=dat),T); print(result) x1=x2; dat2=data.frame(x1)

if (grep('Error',result)<1) cumulator=cumulator+predict(result,x2) }

The above runs and rejects the 'result' until i=6, when lm runs and grep('Error', result) gives:-

Error in if (grep("Error", pred1) < 1) for (i in labels(pred1)) votes[rownames(votes) == :

argument is of length zero

but, predict(result,dat2) runs fine.

Thanks in advance for your help

Jonathan Williams

R-help@stat.math.ethz.ch 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. Received on Tue Oct 10 02:21:27 2006

Archive maintained by Robert King, hosted by
the discipline of
statistics at the
University of Newcastle,
Australia.

Archive generated by hypermail 2.1.8, at Mon 09 Oct 2006 - 17:30:09 GMT.

*
Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help.
Please read the posting
guide before posting to the list.
*