[R] problem with the assignment function

Patrick Burns pburns at pburns.seanet.com
Sat Nov 5 10:35:45 CET 2005


Since you are on Linux, I suggest that you use valgrind:
http://www.valgrind.org/

Download it, build it, then do:

R -d valgrind

and run your function as usual.

It is hard to emphasize enough how useful this is for tracking
down problems in C code.  When developing on Windows,
it would often be worthwhile to get a Linux machine just to be
able to use valgrind.


Patrick Burns
patrick at burns-stat.com
+44 (0)20 8525 0696
http://www.burns-stat.com
(home of S Poetry and "A Guide for the Unwilling S User")

Wang, Yan wrote:

>Hello,
>
> 
>
>I run into the most weird problem I have ever met. I wrote a function
>"rhopair", which calls a .C function. I cannot assign its value to a
>variable using either "=" nor "<-". After I did the assignment,
>"rhopair" cannot reproduce the same result as before with the same
>argument. Here is the code and results:
>
> 
>
>  
>
>>rhopair(x=SNP,bp=bpp[1:700],A=93,B=BB)
>>    
>>
>
>[1] 0.1012352
>
>  
>
>>rhopair(x=SNP,bp=bpp[1:700],A=93,B=BB)
>>    
>>
>
>[1] 0.1012352
>
>  
>
>>a=rhopair(x=SNP,bp=bpp[1:700],A=93,B=BB)
>>    
>>
>
>  
>
>>a
>>    
>>
>
>[1] 0.004524671
>
>  
>
>>rhopair(x=SNP,bp=bpp[1:700],A=93,B=BB)
>>    
>>
>
>[1] 5.241946e-06
>
>  
>
>>a=rhopair(x=SNP,bp=bpp[1:700],A=93,B=BB)
>>    
>>
>
>  
>
>>a
>>    
>>
>
>[1] 0.004524671
>
>  
>
>>sessionInfo()
>>    
>>
>
>R version 2.2.0, 2005-10-06, i686-pc-linux-gnu
>
> 
>
>attached base packages:
>
>[1] "methods"   "stats"     "graphics"  "grDevices" "utils"
>"datasets"
>
>[7] "base"
>
> 
>
>other attached packages:
>
>  fineld   hopach  cluster   fields  lattice
>
> "1.0.0"  "1.2.1" "1.10.2"    "2.0" "0.12-9"
>
> 
>
> 
>
>Any hint or suggestions will be much appreciated.
>
> 
>
>Yan
>
> 
>
>
>	[[alternative HTML version deleted]]
>
>______________________________________________
>R-help at 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
>
>
>
>  
>




More information about the R-help mailing list