Displaying 1 result from an estimated 1 matches for "listlen".
Did you mean:
listen
2011 Apr 27
1
Attempting to access an R list from within C code
...w to access
the values. How do I move from the given SEXP pointer
to the next object in the list? I have tried to use CDR,
but to no avail. The following code gives an
'address (nil), cause unknown'
error:
R Code:
dyn.load("thelib.so")
list1<-list(c(1:3),c(11:13),c(21:23))
listLen<-length(list1)
.C("myfunc",list1,listLen)
C Code (kept in file thelib.c, compiled on Ubuntu x64
machine using R2.13.0):
void showList(SEXP *obj, int *size)
{
SEXP *locObj=obj;
int i;
for(i=0;i<*size;i++){
Rprintf("Entry is %d: value is %f",i,REAL(*locObj)[1]);...