I have 512 MB RAM with a 1.5 GHz processor. The dataset I am working with increases with size with every iteration of the function that I am writing. R can handle the input data which is about 10,000 records, and a single iteration with 19,500 observations. After this, I get the memory.size() error message. I have only written 1 other R function so I am not too familiar with optimizing code. Do you have any suggestions?
Andris Jankevics wrote: > > You havn't said anithing about your OS and version. But basicly I means, > that > you don't have enoigh RAM or swap memory aviable on your system. How large > dataset you have? > > 1. You can optimise your code. :) > > or > > 2. You can just add more RAM to your system, or you can add more swap > space on > your HDD. Work with data in swap will be really slow. > > In linux OS you can add additional swap space, by these commmands: > > 2 GB file: > > dd if=/dev/zero of=/swapfile1 bs=1024 count=2097152 > mkswap /swapfile1 > swapon /swapfile1 > > > > On Friday 31 August 2007 15:27:58 dxc13 wrote: >> w1 <- outer(xk$xk1, data[,x1], function(y,z) abs(z-y)) >> w2 <- outer(xk$xk2, data[,x2], function(y,z) abs(z-y)) >> w1[w1 > d1] <- NA >> w2[w2 > d2] <- NA >> i1 <- ifelse(!is.na(w1),yvals[col(w1)],NA) >> i2 <- ifelse(!is.na(w2),yvals[col(w2)],NA) >> zk <- numeric(nrow(xk)) #DEFININING AN EMPTY VECTOR TO HOLD ZK >> VALUES >> for(x in 1:nrow(xk)) { >> k <- intersect(i1[x,], i2[x,]) >> zk[x] <- mean(unlist(k), na.rm = TRUE) >> } >> xk$zk <- zk >> data <- na.omit(xk) > > > > -- > Andris Jankevics > Assistant > Department of Medicinal Chemistry > Latvian Institute of Organic Synthesis > Aizkraukles 21, LV-1006, Riga, Latvia > > ______________________________________________ > R-help@stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > > -- View this message in context: http://www.nabble.com/memory.size-help-tf4359846.html#a12430698 Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.