[Rd] Subsetting a vector in C

From: Sean Davis <sdavis2_at_mail.nih.gov>
Date: Wed 01 Nov 2006 - 12:48:07 GMT

I have a pretty simple question. I have an array of REALSXP allocated as:

rsp = allocVector(REALSXP,n)

and I simply want to pass subsets of rsp of size q (q<<n), for example, to an R function in C. Is there a way to subset rsp without creating a new REALSXP vector and copying the values for subsetting into it and then passing it to the function? I'm looking for the R equivalent of rsp[1:q], but in C under the R API.

A pointer to source code in the R distribution would be quite helpful, as I haven't found one on my own (at least not one that I recognized as such).


R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Wed Nov 01 23:52:19 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 01 Nov 2006 - 15:30:33 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.