[R-sig-Geo] Problem with operations on large files ("cannot allocate vector of size xx")

Kamil Konowalik konno_kazuma at mailplus.pl
Wed Feb 1 13:19:39 CET 2017


Hi All,
I have a problem with operations on large datasets. I have a several raster files (43) and I would like to make a PCA on them. 
I'm using those simple commands:

files <- list.files("G:/GIS/raster_TIFF",pattern='tif',full.names=TRUE)
s <- raster::stack(files)
pca<-princomp(na.omit(values(s)), cor=TRUE)

But after the last one I'm getting an error: "cannot allocate vector of size 6.6 Gb".
I searched the internet and there are some advices but I couldn't found anything helpful. I'm using Windows 7 64 bit with 8 GB of RAM so it is not an issue with 32 bit. Also I would prefer to find a solution which can use my current resources rather than buying additional RAM. I thought that maybe "bigmemory" package will be a solution but I couldn't make it work. I tried also different file types (ASCII, RASTER, GTiff) but that doesn't help neither. 
It should be a simple and a common problem but I can't figure answer on my own so if you have any working solution I would appreciate it. 
Thanks in advance!
Best regards,
Kamil



More information about the R-sig-Geo mailing list