Re: [Rd] Is it possible to pass a function argument from R to compiled code in C?

From: Gabriel Becker <gmbecker_at_ucdavis.edu>
Date: Tue, 20 Sep 2011 10:45:45 -0700

2011/9/20 Uwe Ligges <ligges_at_statistik.tu-dortmund.de>

> You can evaluate R functions from C, see Writing R Extension.
>

Yes, I think they create a baby lapply function implemented in C (Which obviously involves evaluating a function).

Also, just fyi, you want the .Call interface, not the .C interface.

~G

>
> Uwe Ligges
>
>
>
> On 20.09.2011 19:26, Alireza Mahani wrote:
>
>> I have a function in R that takes another function as argument:
>>
>> f<- function(g, ...) { #g is expected to be a function
>> }
>>
>> I want to see if there is a way to implement "f" in C and calling it from
>> R
>> using ".C" interface. I know that I can use function pointers for my C
>> implementation, but I imagine it's going to be nearly impossible to pass a
>> function from R to C. Are there any exact or approximate solutions

>> available?
>>
>> Thank you,
>> Alireza Mahani
>>
>>
>> --
>> View this message in context: http://r.789695.n4.nabble.com/**
>> Is-it-possible-to-pass-a-**function-argument-from-R-to-**
>> compiled-code-in-C-**tp3827563p3827563.html<http://r.789695.n4.nabble.com/Is-it-possible-to-pass-a-function-argument-from-R-to-compiled-code-in-C-tp3827563p3827563.html>
>> Sent from the R devel mailing list archive at Nabble.com.
>>
>> ______________________________**________________
>> R-devel_at_r-project.org mailing list
>> https://stat.ethz.ch/mailman/**listinfo/r-devel<https://stat.ethz.ch/mailman/listinfo/r-devel>
>>
>
> ______________________________**________________
> R-devel_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/**listinfo/r-devel<https://stat.ethz.ch/mailman/listinfo/r-devel>
>

-- 
Gabriel Becker
Graduate Student
Statistics Department
University of California, Davis

	[[alternative HTML version deleted]]

______________________________________________
R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Tue 20 Sep 2011 - 17:48:03 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 20 Sep 2011 - 18:20:33 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive