Skip to content
Back to formatted view

Raw Message

Message-ID: <3.0.3.32.20010322133532.007d5890@albacete>
Date: 2001-03-22T12:35:32Z
From: Javier Muñoz Criado
Subject: out of memory?
In-Reply-To: <Pine.GSO.4.31.0103220845550.5675-100000@auk.stats>

At 08:49 22/03/01 +0000, Prof Brian D Ripley wrote:
>On Thu, 22 Mar 2001 news_vkhamenya at chat.ru wrote:
>
>> Hello r-help,
>>
>> why call:
>>
>> #----------
>> outer(1:1000, 1:2, function(r,c) ifelse(m[r,c]<=0,.0001,m[r,c]) )
>> #----------
>>
>> for matrix m with only 1000 rows and 2 columns forces my PC to use
>> more than 250Mb(!) of virtual memory?  strange...
>
>Um, a strange use of outer. Try
>
>m[m <= 0] <- 0.0001
>
>for an efficient solution.
>
>-- 
I have also had problems with outer:

> m<-matrix(rnorm(6),3,2);m
           [,1]      [,2]
[1,] -0.4678067 0.6257795
[2,]  1.3981146 0.6273542
[3,] -0.3987765 1.6764002
> outer(1:3,1:2,function(r,c){paste(r,c)})
     [,1]  [,2] 
[1,] "1 1" "1 2"
[2,] "2 1" "2 2"
[3,] "3 1" "3 2"
> outer(1:3,1:2,function(r,c){m[r,c]})
           [,1]       [,2]
[1,] -0.4678067 -0.4678067
[2,]  1.3981146  1.3981146
[3,] -0.3987765 -0.3987765

I should get m here, but I get first column twice.

(R 1.2.2, w95)



---------------------------------------------------
Javier Mu?oz Criado                         
Delegado Provincial                          
Instituto Nacional de Estad?stica
C/ Cura 7 - 02071 Albacete - Espa?a
Tel 967 219 230 - Fax 967 216 649
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._