Skip to content

Excel-to-R Interface

6 messages · Hengyi Xue, Brian Ripley, Jeff Miller +2 more

#
Hi,

I have some questions about Excel-to-R interface and I hope somebody can help me. Is it possible to call functions in a self-defined package from Excel using the Excel-to-R interface? We created the package successfully and can run all the functions inside R. But when we tried to run them from Excel, we kept running into problems. It seems we can not run anything that is not in the base package. I know that the DCOM server is communicating with R compiled as DLL. Is it possible to compile our self defined package into DLL?

Any help will be appreciated.

Hengyi Xue
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://stat.ethz.ch/pipermail/r-help/attachments/20010108/6176989a/attachment.html
#
On Mon, 8 Jan 2001, Hengyi Xue wrote:

            
can help me. Is it possible to call functions in a self-defined package
from Excel using the Excel-to-R interface? We created the package
successfully and can run all the functions inside R. But when we tried
to run them from Excel, we kept running into problems. It seems
we can not run anything that is not in the base package.
I know that the DCOM server is communicating with R compiled as DLL.
Is it possible to compile our self defined package into DLL?

Is this about Erich Neuwirth's RServer Excel add-in on Windows?
It's not very obvious, and on CRAN that is called an R-Excel Interface.
With addons to R it is often most effective to ask the author direct.

Let me pick up on the last point.  The DCOM server communicates with R,
period.  The base package is not in the DLL, and it is exactly the same R
as used by the GUI and terminal front-ends.  So if you send "library(foo)"
via the DCOM execute method, it works just as if you typed it at the
command line.  It makes no sense (to me) to `compile our self defined
package into DLL': packages are mainly interpreted code.

The extras in the DCOM interface are means to transfer simple R objects to
and fro.  As far as I recall you have access to the full DCOM interface
from RServer via writing VBA.
#
Is there an easy way to automatically run an R function at fixed
intervals of time?

    For example, if I have a file,  mydata.txt, which is updated every
minute or so,
    is there an R or an S function which would execute the command

    mydata <- read.table("mydata.txt")

    each minute?  Basically I just want "mydata" to be constantly updated
without
    my having to bother with it.

    Thanks in advance,

        Jeff Miller


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
Hi!

I can only speak for the Linux/Unix enviroment:

Try 

while(TRUE)
{
system("sleep 60")

mydata <- read.table(...)
}

to update mydata after a 60 second break. 
An alternative is to use "cron" or "at". Both allow the specification
of exact execution times, while the "while" approach tries to imitate
a real time system. 


Have a nice day
Detlef


Detlef Steuer ** Universität der Bw ** 22043 Hamburg
Tel: (0049) (0)40/6541-2819
steuer at unibw-hamburg.de
On 09-Jan-01 Jeff Miller wrote:
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
On Tue, 9 Jan 2001 detlef.steuer at unibw-hamburg.de wrote:

            
There is a Sys.sleep function in R these days.  BUT, under that
approach, the R process does nothing but update its internal copy of
.RData, and I don't think that is useful.  In particular, nothing can ever
be done with mydata, as nothing else can be run.

What I think Jeff Miller wants is for a task to be run in the background of
the R session to update mydata, while he gets on with some work at the
prompt. That's a lot harder. R is single-threaded and does not have
(user-specified timer) events.  Not quite impossible, though, as it does
have an event loop to handle UI events, and one could subvert this by some
C programming.

The difference between Sys.sleep(60.0) and system("sleep 60") is that the
former keeps the event loop ticking over, and that it works across
platforms.

Jeff mentioned S. S version 4 does have events and monitors, but I have
never been sure how much of that is operational in S-PLUS 5/6.x.

  
    
#
I haven't gotten around to trying this, but there's a perl script called
"atchange" available at www.lecb.ncifcrf.gov/~toms/atchange.html that
apparently monitors a file and runs some instructions when the file
changes.

It might do what you want.

Matt Wiener


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._