Diann,

That is a bug. It is probably because you repeatedly use a set.seed()
statement somewhere in your code (or run the same code more than once). The
temp file is randomly generated so after set.seed() is called the same
filename may re-occur. I have fixed that for the next version of raster.
For now you can circumvent this problem by providing a filename='' argument
to calc.

Robert

On Sat, Mar 24, 2012 at 4:15 PM, Diann Prosser <dprosser@usgs.gov> wrote:

> Hi R geo gurus-
>
> I am using the raster package to run functions on large spatial datasets
> (>19million cells * many iterations thereby producing large arrays or
> brickrasters).
>
> The system has written my function to a temporary file because it is too
> large to be held in memory. *Can only 1 temporary file be used? If I try to
> run a subsequent function, I get an error (see below) that my temporary
> grid
> already exists and that I should allow OVERWRITE (which I don't want).
>
> Is it a problem to use temporary files in this manner* *(i.e., should I
> already be manually saving them to disk)?*
>
> Thanks for any advice you might have.
>
> the error:
> > system.time(stBSte1 <- calc(s3, FUNstBSte1))
> Error in .startRasterWriting(x, filename, format = filetype, ...) :
>  C:/Users/Diann/AppData/Local/Temp/R_raster_tmp/raster_tmp_9271340493.grd
> exists. use 'overwrite=TRUE' if you want to overwrite it
> Timing stopped at: 0.19 0 0.18
>
> some other info:
> > showTmpFiles()
> raster_tmp_5942113574 raster_tmp_67775104885 raster_tmp_9271340493
> > rasterTmpFile()
> [1]
> "C:/Users/Diann/AppData/Local/Temp/R_raster_tmp/raster_tmp_5652878174.grd"
>
>
> --
> View this message in context:
> http://r-sig-geo.2731867.n2.nabble.com/temp-files-in-raster-tp7402174p7402174.html
> Sent from the R-sig-geo mailing list archive at Nabble.com.
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

	[[alternative HTML version deleted]]

