[Rd] Embed R, and provide a function to user scripts

Saptarshi Guha saptarshi.guha at gmail.com
Fri Aug 14 04:31:49 CEST 2009


Sorry about the clutter. The answer can be found on Writing R Extensions
"

8.1.3 Registering symbols"


Thank you

Saptarshi Guha


On Thu, Aug 13, 2009 at 10:01 PM, Saptarshi Guha
<saptarshi.guha at gmail.com> wrote:
>
> Essentially I'd like to load the C function into  the load table
> After that, I can create an R function
> rboo=function(x) .Call("boo",x)
>
> then user script cann call rboo
>
> Hope that clarifies things.
> Thanks in advance
>
> Saptarshi Guha
>
>
> On Thu, Aug 13, 2009 at 9:07 PM, Saptarshi Guha <saptarshi.guha at gmail.com> wrote:
>>
>> Hello,
>> I'm not sure how to go about this. Suppose I have a function
>>
>> SEXP boo(SEXP x){
>> //do something
>> }
>>
>> Also, I have an executable which embeds R in itself. I would like to provide a R function to user code to call that calls 'boo' e.g
>>
>> ##user supplied expression that is given to me
>>
>> x<-1
>> boo(x)
>>
>> One way is to create a library with function boo that performs .Call to boo, but is there a way that I can do something like
>>
>> ainstall("rboo", boo)
>>
>> and calls to rboo in the language will be sent to 'boo' ?
>>
>> Thank you
>> Saptarshi
>>
>>
>>
>> Saptarshi Guha
>



More information about the R-devel mailing list