I have some code to handle warnings thrown because a device does not support some features:
bla = tryCatch( plot(d$ratio,-log10(d$pvals),col="#00000033",pch=19,xlab=xlab, ylab=ylab), warning=function(bla){dev.off(); return(1)} ) if(!is.null(bla)){ plot(d$ratio,-log10(d$pvals),col=1,pch=19,xlab=xlab, ylab=ylab) } Problem with the code above is that I need to call dev.off() in the function handling warnings function(bla){dev.off(); return(1)} The dev.off() in the tryCatch closes the device and alle commands send to the device (i.e. par(mforw=c(2,2)) are lost. However, if I don't call dev.off(), all what I write to the device next (i.e. in the subsequent if statment) is'nt plotted. The device appears to be "blocked". regard -- Witold Eryk Wolski ______________________________________________ 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.