R function to convert rasters to IDRISI format