[R] map() and C++ interface

Prof Brian D Ripley ripley at stats.ox.ac.uk
Thu Feb 3 10:09:22 CET 2000


On Thu, 3 Feb 2000, Nokome Bentley wrote:

> I am just beginning to use R for Windows and have two (perhaps naive)
> questions:
> 
[Q1 on maps left for others]

> 2.  I am doing simulations using a C++ and am looking for a way to easily
> transfer outputs to R.  Text files are an obvious way but it would be neat
> to output all my simulation C++ objects into a single .RData file and then
> to analyse and plot them from there.  Is there a way of doing that? Should I
> consult the R source code?  Or would it be easier to create an R package
> from within my C++ code.

You could borrow the R save code, but as you don't have R objects to start
with that would be tricky.  One idea you might like to try is to use hdf5.
As of the next release (next week), there is an hdf5 package available for
the Windows version of R, and Windows libraries are on the HDF5 site. Then
you can use hdf5load to load in all the objects you wrote of a single hdf5
file.

Another idea (which maybe is what you last para meant) is to dynamically
load your C++ into R. Then you can write return or write R objects form
your C++ code (but you will need to understand a lot of the `Writing R
Extensions' manual to do that).

-- 
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