[Rd] .C returned array has odd results

From: Jonathan Lisic <jlisic_at_gmail.com>
Date: Fri, 27 Jan 2012 14:46:25 -0500

Hi, I'm sure this is a fairly simple problem, but I can't seem to find any specific information in the documentation as to what is going on. I am writing a simple nearest neighbor program that takes in a set of of points on a plane and returns the neighbors of those points, for a fixed number of neighbors. However, the returned integer array that is allocated in R seems to occasionally return incorrect results.

I thought this would be because of GC, but I thought this was only for SEXPs, or at least this is the impression I got from reading the documentation. So is there some obvious reason why my results seem to get mangled by this call? I have checked my program through several thousand loops in C, and always get the same results, so I assume that this is something I'm doing wrong in R.

Here is the code for my .C call. I could post the C code if someone thinks it's important, but I'm just changing the values of integer array specified in R.

r.result <-






        [[alternative HTML version deleted]]

R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Fri 27 Jan 2012 - 20:03:00 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 27 Jan 2012 - 21:10:12 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive