title: R: Error thrown while using RGDAL and RASTER packages
body: <p>To whom this may concern:</p>
  
  <p>Here is the source code:</p>
  
  <pre><code>GRA_D1&lt;- raster(files[[1]])
  //Sets up an empty output raster: 
  GRA_D1&lt;- writeStart(GRA_D1,filename='GRA_D1.tif', format='GTiff', overwrite=TRUE)
  
  //Write to the raster, for loop:
  for(i in 1:dim(GRA_D1)[1]){
  
  //Extract raster values at rows
  d.Frame&lt;- matrix(NA,ncol=2,nrow=dim(GRA_D1)[2])
  d.Frame[,1]&lt;- getValues(r1[[1]],i) 
  d.Frame[,2]&lt;- getValues(r1[[2]],i)
  
  w.Frame&lt;- as.data.frame(d.Frame)
  names(w.Frame)&lt;- c("D1_pred_disAg","D1_pred_RK")
  //Apply the predictive model:
  m.pred&lt;-predict(mod.1, w.Frame) 
  
  //Write the predictions to the empty TIFF raster
  GRA_D1&lt;-writeValues(GRA_D1,m.pred,i) 
  print(i)}
  
  //Finish writing to the raster
  GRA_D1&lt;- writeStop(GRA_D1) 
  </code></pre>
  
  <hr>
  
  <p>I am attempting to write output to an empty TIFF raster, but I keep receiving the following error message:</p>
  
  <pre><code>#Error in .local(.Object, ...) : 
  `general_file_path\GRA_D1.tif' does not exist in the file system,
  and is not recognised as a supported dataset name.
  </code></pre>
  
  <hr>
  
  <p>I wonder if this is related to misusing functions in either the RGDAL or RASTER package.</p>
  
  <p>Could someone please assist me?</p>
  
  <p>Thanks in advance for your generosity.</p>
  
  <p>Cheers,
  AD</p>