I am running an R script through RStudio Server which is installed on a Linux virtual machine. The script uses the raster package to extract values from hundreds of geotiffs. I am processing each geotiff separately through a loop and extracting values at multiple points with several buffer values (also through a loop). The geotiffs are stored on a mounted network drive.
Intermittently, after reading in a raster and then doing the extract call, I receive the error: "Error in .local(.Object)". If I then re run the exact same extract call in the console, it runs fine without error.
The script has previously run fine in RStudio on my laptop where the files are also on my laptop. I am now running the same script on the dedicated virtual machine. I have accessed the RStudio Server session via the web browser on my remote laptop, and on the VM itself. I have received the same result with intermittent error occurring.
I am wondering if at points the connection to the mounted drive goes to sleep, or when the R session goes to sleep, or the VM locks, or something like that. I am struggling to troubleshoot the error as it is not reproducible even by me.
Does anyone have any suggestions on how I may got about finding the cause of the error?
I was hoping to run the script on the dedicated VM as that is what it is designed for, and it means I do not need to leave my laptop on processing for length periods. But this error is making that untenable as I have to keep checking in on the session to see if it has had an error yet.