From Roger.Bivand at nhh.no  Fri Nov 16 22:00:41 2007
From: Roger.Bivand at nhh.no (Roger Bivand)
Date: Fri, 16 Nov 2007 22:00:41 +0100 (CET)
Subject: [Rd] Returning vectors of two different data types back to R
 environment (from C).
In-Reply-To: <8adccabf0711161249n763c3290o1ec4bab4bea1a104@mail.gmail.com>
References: <8adccabf0711161249n763c3290o1ec4bab4bea1a104@mail.gmail.com>
Message-ID: <Pine.LNX.4.64.0711162158560.9311@reclus.nhh.no>

On Fri, 16 Nov 2007, Charles Danko wrote:

> Hello,
>
> Quick question.
>
> I have written a C function - I would like to make it return two vectors to
> the R environment - one STRSXP vector, and one INTSXP vector.  Is this
> possible/ easy to do using the API?
>
> I looked, but could not find the answer to this  question in the "Writing R
> Extensions" guide.

Put them in a list? The SEXP function in the .Call() interface then 
returns a list wich you unpack on the R side. There are plenty of examples 
in the base code and in numerous contributed packages.

>
> Thanks very much for your help!
> Charles
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

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



[Rd] Returning vectors of two different data types back to R environment (from C).
Roger Bivand