search for: set_el

Displaying 2 results from an estimated 2 matches for "set_el".

Did you mean: set_elt
2004 Jan 09
1
Call and memory
...NTER(Ni)[0]; int k=INTEGER_POINTER(ki)[0]; SEXP alist; SEXP avector; SEXP nvector; SEXP rvector; SEXP kvector; int n; int i; transposeMatrix(pX,N,k); n=4; PROTECT(alist=NEW_LIST(n)); PROTECT(avector=NEW_NUMERIC(200)); for (i=0;i<200;i++) { NUMERIC_POINTER(avector)[i]=pX[i]; } SET_ELEMENT(alist,0,avector); UNPROTECT(1); PROTECT(nvector=NEW_INTEGER(1)); INTEGER_POINTER(nvector)[0]=N; SET_ELEMENT(alist,1,nvector); UNPROTECT(1); PROTECT(rvector=NEW_NUMERIC(1)); NUMERIC_POINTER(rvector)[0]=0.5; SET_ELEMENT(alist,2,rvector); UNPROTECT(1); PROTECT(kvector=NEW_INTEGER(1));...
2006 Jul 26
1
.Call question
...ample of the essence of the problem. This seems to work. Is this dangerous or ok? (of course, I want to do something more complicated since I can do this in R, but I hope this illustrates my question). SEXP modlist(SEXP list, SEXP ind, SEXP element){ int index; index=INTEGER_VALUE(ind); SET_ELEMENT(list,index,element); return(ind); } called in R as in lst=list("a","b","c") element="d" out=.Call("modlist",lst,1,element) here the .Call is used just for its effect on lst. thanks! peter ................................ Peter E. Ros...