From stefan.evert at uos.de  Wed Nov  4 13:40:06 2009
From: stefan.evert at uos.de (Stefan Evert)
Date: Wed, 4 Nov 2009 13:40:06 +0100
Subject: [Rd] Cannot Change Function (PR#14041)
In-Reply-To: <20091104075013.58C5F282EF4D@mail.pubhealth.ku.dk>
References: <20091104075013.58C5F282EF4D@mail.pubhealth.ku.dk>
Message-ID: <02DC0A8C-49D4-49DD-9F81-10344F944B4E@uos.de>

What makes you think this is a bug in R?

> Whenever I try changing a function, it keeps coming up with the same  
> error
> message.
>
> I have the function
> CN_state_log_sum=function(Tot_log_sum){ #estimate copy number state  
> for the log
  [...]
> }
>
> When I try to run it in the loop:
> for (j in 1:length(BB_mean_ref)){	# find copy number states (0 for  
> homozygous
> deletion, 1 for hemizygous deletion, 2 for neutral, 3 for single  
> amplification,
> 4 for multiple amplification)
> 	state_log_sum[j]=CN_state_log_sum(Tot_log_sum[j])
> 	state_sum_log[j]=CN_state_sum_log(Tot_sum_log[j])
> }
> I get the error message:
> Error in Im(Tot_sum_log) != 0 || Re(Tot_sum_log) <- 2 :
>  could not find function "||<-"

The error message indicates that the problem happens in the function  
CN_state_sum_log() rather than CN_state_log_sum(), so it's hardly  
surprising that changing the latter doesn't have any effect.

My guess: you've go a condition (Re(Tot_sum_log)<-2), which is  
mistaken for the assignment operator "<-" by the R parser. Adding some  
whitespace (Re(Tot_sum_log) < -2) should help both R and human readers  
to make sense of it.

Best,
Stefan



[Rd] Cannot Change Function (PR#14041)
Stefan Evert