From simon.urbanek at r-project.org  Fri Jun 17 16:29:53 2011
From: simon.urbanek at r-project.org (Simon Urbanek)
Date: Fri, 17 Jun 2011 10:29:53 -0400
Subject: [Rd] Controlling stdin and stdout in an embedded R instance
In-Reply-To: <4DFA880F.4000802@harmonia.com>
References: <4DFA880F.4000802@harmonia.com>
Message-ID: <3354124D-8F54-4AD5-BA04-2393F8F03056@r-project.org>

Mike,

there are many examples of embedding R, one of them is rJava/JRI and you can see how to initialize R with custom callbacks at
http://svn.rforge.net/org/trunk/rosuda/JRI/src/Rinit.c

Cheers,
Simon



On Jun 16, 2011, at 6:47 PM, Mike Sonsini wrote:

> Hello,
> 
> I am very new to R but my question is with respect to the C API for working with an embedded R console. I have been able to start and stop an embedded R console from within a C program as well as use the API to execute commands in it. I am seeking a mechanism to individually send native R commands to an embedded console and then consume the output of these commands. Specifically, I cannot send a set of commands to the embedded console and then consume all of the output after the execution completes. I have unsuccessfully attempted to assign values to the ptr_R_ReadConsole and ptr_R_WriteConsole function pointers defined in Rinterface.h but do not know if this is a valid approach. I am working in Ubuntu 10.04 and thus the Windows example at the following address is not applicable.
> 
> http://cran.r-project.org/doc/manuals/R-exts.html#Calling-R_002edll-directly
> 
> Does anyone on this list have experience or an example of communicating with an embedded R console using native R commands and consuming the output one command at a time in a "Unix-alike" environment?
> 
> Thank you,
> Mike Sonsini
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
> 
> 



[Rd] Controlling stdin and stdout in an embedded R instance
Simon Urbanek