Reputation: 4090
I have reinstalled R because of disfunction of pgirmess package. I have re-downloaded all necessary packages. I have used the same script that works fine before re-installation. However I cant read raster objects and I obtain a message:
Error: file.exists(filename) is not TRUE
but I know that these files exist!
If I am running {raster} exemple
f <- system.file("external/test.grd", package="raster")
f
r <- raster(f)
{raster} and R works fine. Any help? I cant really imagine where the problem could be! (I have verified a working directory, check file existence in different program, restarted R and computer, tried to read different rasters from different directories...). When I try to read tables, it works fine. Only raster files are problematic. Thank you really much
How it looks in R:
> getwd() # where am I working?
[1] "D:/UEL/Data/2014_05_21 classify final/indexy"
> file.exists("n_msi2011.img") # does file exist?
[1] TRUE
> a<-raster("D:/UEL/Data/2014_05_21 classify final/indexy/n_msi2011.img") # read
# existing
# file
Error: file.exists(filename) is not TRUE # why???
Upvotes: 2
Views: 6679
Reputation: 137
I had the same problem. It went away after I installed and loaded the package rgdal
See code below:
library(raster)
library(rgdal)
object <- raster("object.img")
Upvotes: 5
Reputation: 4090
the problem was in not well updated {sp} package. After its reinstallation and then updating {raster} pkg the problem was fixed.
Recommendation for the futur reinstalation of R (Win7):
update.packages(checkBuilt=TRUE, ask=FALSE)
and it has to work!
Upvotes: -1