Displaying 1 result from an estimated 1 matches for "vecref".
Did you mean:
vecreg
2007 Mar 14
1
allocVector reference
...e
header plus a pointer to the data, I'm not sure what I'm trying to do is
possible. Is there a way of doing this? Similar in spirit to how the R
assignment "x=y" does not copy y until x is modified, but for a
contiguous subset of y e.g. "x=y[5:9]" would become "x=vecref(y,5,5)".
SEXP vecref(SEXP v, SEXP offset, SEXP len)
{
// assuming v is an integer vector, offset>=0, len>=0 and
(offset+len)<length(v)
SEXP ans;
PROTECT(ans = allocVector(INTSXP, 0));
DATAPTR(ans) = INTEGER(v) + INTEGER(offset)[0]; // this
line doesn't work since...