Skip to content
Prev 26750 / 63424 Next

Returning vectors of two different data types back to R environment (from C).

SEXP x,y,res;
PROTECT(res = allocVector(VECSXP, 2));
SET_VECTOR_ELT(res, 0, x = allocVector(REALSXP, 20)); 
SET_VECTOR_ELT(res, 1, y = allocVector(INTSXP, 10)); 
// code with x,y goes here

UNPROTECT(1);
return res;
On Fri, 2007-11-16 at 15:49 -0500, Charles Danko wrote: