Skip to content
Back to formatted view

Raw Message

Message-ID: <3EAD09E0.2010409@statistik.uni-dortmund.de>
Date: 2003-04-28T11:00:48Z
From: Uwe Ligges
Subject: Writing a function
In-Reply-To: <OF765DF177.C3E3F9A6-ONC1256D16.0037E61E@ges.marc.societe-generale.fr>

vincent.stoliaroff at socgen.com wrote:
> Hi r lovers,
> 
> I have written the following  function
> 
> 
>>ClearDeltaBis
> 
> function(Matrix){
> for (i in 1:3)
>                         {
>                         for (j in 1:2)
>                                 {if (is.na(Matrix[i,j]))
> NA->(Matrix[i,j+1])}
>                         }
> Matrix
> }
> 
> it looks correct but when I try to implement it on the MatCor Matrix I get
> this error message
> 
> 
>>ClearDeltaBis(MatCor)
> 
> Error: couldn't find function "(<-"
> 
> I don't understand where does it come from since I have no string like (<-
> in my code
> 
> 
> Thanks for any help that could be provided.

Hint:

   NA->(Matrix[i,j+1])

is syntactically almost the same as

   (Matrix[i,j+1]) <- NA

but the latter (without the brackets) is less confusing.

Uwe Ligges