[R-sig-Geo] RE rgdal: Memory error!
Yong Li
yong.li at unimelb.edu.au
Tue Jul 15 13:41:26 CEST 2008
Hi All,
I ran the following code and got the below error:
"Error: cannot allocate vector of size 30.3 Mb".
Actually my laptop has 4096 MB ram, and I increased the limit already.
Pls advise any tips to let me pass through.
I guess Dr Hengl experienced this before.
Regards
Yong
#-----------------------------------------------------------------------
----
memory.size()
memory.size(TRUE)
memory.limit(size=4000)
round(memory.limit()/1024, 2)
options(scipen=3)
options(digits=15)
rm(list=ls())
require(sp)
require(gstat)
require(maptools)
cellsize <- 25
# 1 2 3 4 5
VarName=c("logit(SOM)","logit(TN)","logit(AVN)","logit(OLSENP)","logit(A
VK)")
out=paste("Variable","No","Model","C0","C","Spatial","Range","R2","p","S
SE",sep=",")
setwd("C:/Rcode/EJSS/Hongtong/county")
data <- read.csv("htfs_19N_2005_A.csv", header = TRUE, sep = ",")
names(data)
class(data)
coordinates(data) <- ~X+Y
proj4string(data) <- CRS("+proj=tmerc +lat_0=0 +lon_0=111 +k=1.0
+x_0=500000 +y_0=0 +ellps=krass +units=m +no_defs
+towgs84=22,-118,30.5,0,0,0,0")
library(rgdal)
predictors = readGDAL("VIs/GSI.mpr")
predictors$CI = readGDAL("VIs/CI.mpr")$band1
predictors$WRNDVI = readGDAL("VIs/WRNDVI.mpr")$band1
predictors$ARVI = readGDAL("VIs/ARVI.mpr")$band1
predictors$NDWI = readGDAL("VIs/NDWI.mpr")$band1
predictors$EVI = readGDAL("VIs/EVI.mpr")$band1
predictors$DEM = readGDAL("Terrain/ht_dem.mpr")$band1
predictors$CONVERG = readGDAL("Terrain/ht_converg.mpr")$band1
predictors$PLANC = readGDAL("Terrain/ht_planc.mpr")$band1
predictors$PROFC = readGDAL("Terrain/ht_profc.mpr")$band1
predictors$SLOPE = readGDAL("Terrain/ht_slope.mpr")$band1
predictors$TWI = readGDAL("Terrain/ht_twi.mpr")$band1
predictors$GSI = predictors$band1
predictors$band1 = NULL
proj4string(predictors) <- CRS("+proj=tmerc +lat_0=0 +lon_0=111 +k=1.0
+x_0=500000 +y_0=0 +ellps=krass +units=m +no_defs
+towgs84=22,-118,30.5,0,0,0,0")
#-----------------------------------------------------------------------
----
More information about the R-sig-Geo
mailing list