[R] Internal data types

Prof Brian D Ripley ripley at stats.ox.ac.uk
Wed Nov 24 08:17:43 CET 1999


On Tue, 23 Nov 1999, John D. Barnett wrote:

> Hi-
> 
> I'm very interested in using R, though I am still new to it.  However,
> all of the data I'm working with is currently stored in Oracle.  So,
> either I get data from Oracle, save it to a text file, and then import
> it to R, or I write an R <-> Oracle bridge.  I've taken the second
> approach, but I'm sure that I haven't done it entirely correctly.
> 
> For starters, is there any unified documentation for the R/C interface?

Not yet, but

(a) It is pretty similar to the S one, and
(b) I think you should be using the .Call interface. This is now
documented in `R-external' manual which is in the 0.90.0 documentation
(cd doc/manual,  make dvi or make pdf).

> I can currently get back the results of a SQL query in a list of
> vectors; however, the process is quite slow and CPU intensive.  This is
> probably because I fill in the data structure in R, and call C to get
> every single value.  It makes more sense to me to loop in C and create
> the entire data structure there, but I'm not quite sure how to approach
> this.

Use .Call is the key.

> I think that what I want to do is actually create the appropriate SEXPR
> for a list, with each element being a vector (numeric or string).  This
> would presumably be through allocList() and allocVector(), but how then
> do I access individual elements of an SEXPR (list or vector) from C?
> (i.e., are there access functions that I'm missing, or do I have to wade
> through the structure definition of SEXPR?)

See the `R-external' manual. There are two sets of access definitions,
in Rdefines.h and Rinternals.h

I hope that helps you enough.  If not, your only recourse is to study
examples in the R source code (which is how that manual got written),
or ask for help. (It might be good to ask really technical points
on R-devel, as I suspect everyone who knows about this is on that list.)

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list