Re: [R] memory.size help
At 13:27 31/08/2007, dxc13 wrote: I keep getting the 'memory.size' error message when I run a program I have been writing. It always it cannot allocate a vector of a certain size. I believe the error comes in the code fragement below where I have multiple arrays that could be taking up space. Does anyone know a good way around this? It is a bit hard without knowing the dimensions of the arrays but see below. 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) If I read this correctly after this point you no longer need w1 and w2 so what happens if you remove them? 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) -- View this message in context: http://www.nabble.com/memory.size-help-tf4359846.html#a12425401 Sent from the R help mailing list archive at Nabble.com. Michael Dewey http://www.aghmed.fsnet.co.uk __ 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.
[R] memory.size help
I keep getting the 'memory.size' error message when I run a program I have been writing. It always it cannot allocate a vector of a certain size. I believe the error comes in the code fragement below where I have multiple arrays that could be taking up space. Does anyone know a good way around this? 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) -- View this message in context: http://www.nabble.com/memory.size-help-tf4359846.html#a12425401 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.
Re: [R] memory.size help
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.
Re: [R] memory.size help
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.