From oliver at first.in-berlin.de  Fri Jun  3 12:17:12 2011
From: oliver at first.in-berlin.de (oliver)
Date: Fri, 3 Jun 2011 12:17:12 +0200
Subject: [Rd] C-Side: Applying a function (given as param) to data (given as
 param)
Message-ID: <20110603101712.GD6048@siouxsie>

Hello,

I'm implementing a package (C-extension),
where one function gets data and a function
that needs to be applied to the data.

I want to apply the function to (parts of)
the data on the C-side.

1) how do I apply a function (given via SEXP) to data
2) how do I select parts of the data (also provided via SEXP)?

Comment on 2: I want to implement a moving/rolling/running
apply on the data, so I want to select a data window.
How can this be done, and how can it be done efficiently?

For example on page 101 of "Writing R extensions" there was a trick
on how to use REAL on the result, before using it in a loop.
Can this be used for efficiency reasons in general?


 Ciao,
    Oliver


P.S.: What do these macros (like REAL()) do? Do they convert data
      or rather cast datatypes?



[Rd] C-Side: Applying a function (given as param) to data (given as param)
oliver