R and DDE (Dynamic Data Exchange) Dear Rusers, I run an application (not mine) which acts as a DDE server. I would like to use R to get data from this application, say once per minute, and do some processing on it. I didn't find much info on the R DDE abilities, apart the tcltk2 package in which I will try to go deeper. I would be very thankful for any info, pointer or advice about the "good ways" to make R program get online data from a DDE server. Thanks Vincent
Hello Vincent, I think there is not much else than tcltk2. It is a complete implementation of DDE (client/server), so it should fit your needs. There are lots of examples on the man page. Please, if you think it could be helpful for other users, do submit examples. I think real-time acquisition of data through DDE under Windows would interest a couple of users (including myself). Best, Philippe Grosjean ..............................................<?}))><........ ) ) ) ) ) ( ( ( ( ( Prof. Philippe Grosjean ) ) ) ) ) ( ( ( ( ( Numerical Ecology of Aquatic Systems ) ) ) ) ) Mons-Hainaut University, Belgium ( ( ( ( ( .............................................................. vincent at 7d4.com wrote:> R and DDE (Dynamic Data Exchange) > > Dear Rusers, > I run an application (not mine) which acts as a DDE server. > I would like to use R to get data from this application, > say once per minute, and do some processing on it. > I didn't find much info on the R DDE abilities, apart the tcltk2 > package in which I will try to go deeper. > I would be very thankful for any info, pointer or advice about the > "good ways" to make R program get online data from a DDE server. > Thanks > Vincent > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html > >
You can access DDE via COM as in this example which uses DDE to open an Excel file. Note that Excel also supports COM directly and normally one would use COM with Excel, not DDE, so you might check if your application also supports COM. # opens an excel spreadsheet c:\test.xls using dde library(RDCOMClient) sh <- COMCreate("Shell.Application") sh$Namespace("C:\\")$ParseName("test.xls")$InvokeVerb("&Open") Also if you are going to access DDE via COM or just COM also check out the rcom package which is similar to RDCOMClient. On 7/17/06, vincent at 7d4.com <vincent at 7d4.com> wrote:> R and DDE (Dynamic Data Exchange) > > Dear Rusers, > I run an application (not mine) which acts as a DDE server. > I would like to use R to get data from this application, > say once per minute, and do some processing on it. > I didn't find much info on the R DDE abilities, apart the tcltk2 > package in which I will try to go deeper. > I would be very thankful for any info, pointer or advice about the > "good ways" to make R program get online data from a DDE server. > Thanks > Vincent > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html >
Thanks Gabor and Philippe. Special thanks to Philippe for his tcltk2 nice job. I'm testing differents approaches for my problem. I'll return info if I use DDE + tcltk2. Vincent
I am thrilled to learn tcltk2 has DDE capability. It is the piece I have been needing to make ESS work directly with the RGUI on Windows. GNU emacs on Windows has a ddeclient, but no access to COM. So if R, or tcltk2 talking in both directions to R, has a ddeserver, all should be possible. I will be reading the documentation closely in a few weeks to tie it together and then intend to make it happen. Do you, or any other list member, have a sense of the size, complexity, ease, magnitude of the task I just defined? Any advice as I get started on it? Rich
Richard M. Heiberger wrote:> I am thrilled to learn tcltk2 has DDE capability. > It is the piece I have been needing to make ESS work directly > with the RGUI on Windows. GNU emacs on Windows has a ddeclient, > but no access to COM. So if R, or tcltk2 talking in both directions to R, > has a ddeserver, all should be possible. I will be reading the documentation > closely in a few weeks to tie it together and then intend to make it happen. > > Do you, or any other list member, have a sense of the size, complexity, ease, > magnitude of the task I just defined? Any advice as I get started on it? > > RichWell, to be honest, DDE is an old exchange protocol (the first one proposed by M$ in Windows version 1 or 2). It is not that reliable. In practice, when the communication is working fine, you have no problems with it. But if something fails in either the server or the client, you got a very bad behaviour sometimes. I think there is some interest to have DDE available for R (WinEdt uses DDE, I think... Uwe???), together with (D)COM, and socket server. Currently, I am improving the socket server build in svSocket (SciViews bundle) because it is the communication protocol we decided to push forward in Tinn-R, but there are other implementations out there. I think that using a socket server is more reliable and it is also a cross-platform solution. So, I would personnally prefer that solution. Best, Philippe Grosjean
On 7/19/06, Philippe Grosjean <phgrosjean at sciviews.org> wrote:> Richard M. Heiberger wrote: > > I am thrilled to learn tcltk2 has DDE capability. > > It is the piece I have been needing to make ESS work directly > > with the RGUI on Windows. GNU emacs on Windows has a ddeclient, > > but no access to COM. So if R, or tcltk2 talking in both directions to R, > > has a ddeserver, all should be possible. I will be reading the documentation > > closely in a few weeks to tie it together and then intend to make it happen. > > > > Do you, or any other list member, have a sense of the size, complexity, ease, > > magnitude of the task I just defined? Any advice as I get started on it? > > > > Rich > > Well, to be honest, DDE is an old exchange protocol (the first one > proposed by M$ in Windows version 1 or 2). It is not that reliable. In > practice, when the communication is working fine, you have no problems > with it. But if something fails in either the server or the client, you > got a very bad behaviour sometimes.There is a good discussion in this DDE FAQ of when DDE would be preferred and when COM would be: http://www.angelfire.com/biz/rhaminisys/ddeinfo.html#DDEpreferred
Gabor, Thank you for that information. The reason for choosing DDE is that GNU emacs doesn't speak COM. Every year or so I ask on the emacs-for-windows list, and every year I get the answer no. DDE is the technology that I have been using in ESS for sending information to the S-Plus Commands window in the S-Plus GUI on Windows. I want to send information to the Rgui window on Windows in the same way. The Rterm window runs on Windows emacs in an *R* buffer exactly the way R runs on Unix. But it doesn't interact smoothly with other Windows programs. The specific difficulty that I want to solve now is the interaction with RExcel. RExcel and RGui work together smoothly. RExcel and Rterm in an emacs *R* buffer do not work smoothly (emacs buffers freeze requiring ^G to get control back). Rich