4 Something that worked for me... Title: Running R over the Web Author: Ewan Crawford, ewan@stats.gla.ac.uk Title: Weighing the Odds: a course in Probability and Statistics. David Williams. Cambridge University Press, 2001. ISBN 0 521 80356 X ISBN 0 521 00618 X Author: J.Biggins, j.biggins@sheffield.ac.uk Have You Seen This? T his book is a serious introduction to the theory of probability and what might be called the mathematical ideas of statistics, with enough in it for several undergraduate courses in a mathematics degree. The clear aim is to interest the mathematical student in the area through important examples and nice applications of mathematics. David Williams is the right person to take on this task; he is a very distinguished mathematician with an enthusiasm for the subject which lights up the book. The book should be read, and the contents pondered on, by everyone who teaches ‘second courses’ on probability or statistics in a mathematics degree; any good student on such courses would surely be excited by the book. As well as covering that kind of material, and quite a lot more, very well, it also provides abundant reasons, in discussion and through asides, to want to study the contents of much of book’s bibliography. For myself, I particularly enjoyed the wealth of mathematical ideas mentioned in passing, the pretty way so many mathematical things were handled, the discussion of the Bayesian-Frequentist controversy, the discussions of the relation between probability and statistics and between mathematics and reality, and the references to the computer package WinBUGS, which I found so infectious that I had to try the package myself. R: http://www.r-project.org/ Rweb: http://www.math.montana.edu/Rweb/ R-(D)COM Interface: http://cran.r-project.org/contrib/extra/dcom/ R example: http://www.ltsn.gla.ac.uk/r/ T here are a number of ways to run R [1] over the web. For instance one can ‘shell’ it from a Perl, ASP or PHP script. The recent article “Web-Created Real Data Worksheets” [2] discusses the use of RWeb to carry out routine calculations. This implementation runs on a Windows 2000 server using R by ‘shelling’ from ASP scripts. Another approach to Rweb’s ‘shelling’ the program is to make R memory resident and call it as required. This approach is highly suited to using R as a background library which can be called by Excel, Visual Basic, ASP web pages or any number of other programs. The method I’ve used turns R into a (D)COM object. This sounds quite technical but is actually quite easy. If you want to try this, here’s how to go about it; 1. You may need to download a copy of R. Go to the R website ( http://www.r-project.org/) and download the latest Windows version of R. 2. Install R. 3. Download the (D)COM Interface for R. ( http://cran.r- project.org/contrib/extra/dcom/) 4. Install this Interface. I found everything I needed to know about installation in the readme.txt file which you can download. 5. The section in the readme.txt file is great for running R from Visual Basic, but does not work for ASP scripts. Here’s my simple test script; <%@LANGUAGE=”VBSCRIPT”%> <% dim x set x = server.createobject(“StatConnectorSrv.StatConnector”) x.init(“R”) ‘Note evaluate uses ordinary R script. x.evaluate “numbers<-c(1,2,3,4,5,6)” x.evaluate “answer<-mean(numbers)” answer=x.getsymbol(“answer”) x.close %> <html> <head> <title>R example</title> </head> <body> The mean of 1,2,3,4,5,6 is <%=answer%> </body> </html> The main disadvantage is that there are known issues (such as occasional ‘hanging’) in the COM server for R. References [1] Ripley, B D (2000). The R Project in Statistical Computing. MSOR Connections. 1, 23-25. [2] Davies, N & Payne, B (2001). Web-Created Real Data Worksheets. MSOR Connections. 4, 15-17