[R] simple example of C interface to R

Roger Bivand
Fri, 04 Feb 2005 20:09:37 -0000

On Fri, 4 Feb 2005 jbdunsmo at utmb.edu wrote:

> i'd like to use the C interface to R in a program i'm writing.  as
a
> starting point, i'm trying to create a very simple C program that uses
> R.  i've read the R documentation on this, but i'm having trouble
> figuring out where SEXP is defined and how to use it.
>
> i noticed someone else on this list also tried to use the C interface,
> but they ran into similar problems:
> http://maths.newcastle.edu.au/~rking/R/help/03b/1942.html
>
> could someone show me a simple example of how to use the R interface
> to C?
>

Well, it is documented in the Writing R Extensions manual:

http://cran.r-project.org/doc/manuals/R-exts.html#System-and-foreign-language-interfaces

and in the source code of many contributed packages - they may give you
good examples - look in their src/ directories. But DO read the manual,
please, that's what it is for!

> thank you,
> jason dunsmore
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html
>

--
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Breiviksveien 40, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93
e-mail: Roger.Bivand at nhh.no