[R] Removing Corrupt file

2010-12-17 Thread vikrant
Hi I am generating a graph jpeg file using a function R. I m using this script a- 1:10 b - 1:10 jpeg(mygraph.jpeg) { plot(a,b) } dev.off() If by some chance I do miss some values suppose for a , the file gets created initially and then we do not plot anything in it. This file now becomes

Re: [R] Removing Corrupt file

2010-12-17 Thread Claudia Beleites
Vikrant, if you execute the code inside a function like jpegplotfun - function (a, b){ jpeg(mygraph.jpeg) plot(a,b) dev.off() } the dev.off () is not executed if an error occurs before. So the problem is basically that the jpeg file is still open (you may noticed open devices in R as

Re: [R] Removing Corrupt file

2010-12-17 Thread David Winsemius
On Dec 17, 2010, at 2:24 AM, vikrant wrote: Hi I am generating a graph jpeg file using a function R. I m using this script a- 1:10 b - 1:10 jpeg(mygraph.jpeg) { plot(a,b) } dev.off() If by some chance I do miss some values suppose for a , the file gets created initially and then we do not