What are some effective ways to leverage the strengths of R and Mathematica for the analysis of a single data set? More specifically, are there any functions that can assist with any of the following? 1. Calling an R function from Mathematica. 2. Calling a Mathematica function from R. 3. Using XML or another reliable data format to pass vectors, matrices, and/or lists from one environment to the other. Any advice would be appreciated. David -- David R. Bickel, PhD Associate Professor Ottawa Institute of Systems Biology Biochem., Micro. and I. Department Mathematics and Statistics Department University of Ottawa 451 Smyth Road Ottawa, Ontario K1H 8M5 http://www.statomics.com Office Tel: (613) 562-5800 ext. 8670 Office Fax: (613) 562-5185
On Jul 14, 2010, at 6:59 AM, David Bickel wrote:> What are some effective ways to leverage the strengths of R and Mathematica for the analysis of a single data set? > > More specifically, are there any functions that can assist with any of the following? > 1. Calling an R function from Mathematica. > 2. Calling a Mathematica function from R. > 3. Using XML or another reliable data format to pass vectors, matrices, and/or lists from one environment to the other. > > Any advice would be appreciated. > > DavidSee: http://www.scienceops.com/Rlink2.asp http://library.wolfram.com/infocenter/Conferences/6510/ Those provide hints on calling R from Mathematica using a commercial application (Windows Vista only apparently). It would seem, logically, that the commercial world (SAS, SPSS, etc.) has deemed it more important to provide R functionality from within their applications, than vice versa. If Mathematica can be run in a batch mode using a CLI interface, it may be possible to call Mathematica from within R using the system() function. However, parsing the results of the Mathematica operation in R will be up to you. Similarly, if Mathematica has the ability to call external batch files, you could run R code in that fashion, again, having to deal with parsing the results in Mathematica. In so far as moving data back and forth, you can review the R Data Import/Export manual: http://cran.r-project.org/doc/manuals/R-data.html to identify common formats (eg. CSV files) that can be used by both applications. I don't use Mathematica, so am unfamiliar with their, presumably proprietary, formats. HTH, Marc Schwartz
Take a look at Sage, which is an open source alternative. It already integrates R.... (http://www.sagemath.org) albyn Quoting David Bickel <davidbickel.com+rhelp at gmail.com>:> What are some effective ways to leverage the strengths of R and > Mathematica for the analysis of a single data set? > > More specifically, are there any functions that can assist with any > of the following? > 1. Calling an R function from Mathematica. > 2. Calling a Mathematica function from R. > 3. Using XML or another reliable data format to pass vectors, > matrices, and/or lists from one environment to the other. > > Any advice would be appreciated. > > David > > -- > David R. Bickel, PhD > Associate Professor > Ottawa Institute of Systems Biology > Biochem., Micro. and I. Department > Mathematics and Statistics Department > University of Ottawa > 451 Smyth Road > Ottawa, Ontario K1H 8M5 > > http://www.statomics.com > > Office Tel: (613) 562-5800 ext. 8670 > Office Fax: (613) 562-5185 > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > >
Hi Albyn, Thank you very much for the suggestion. I managed to install Sage on Windows (via a Linux VM), but I cannot find any documentation on how to use R from Sage. Maybe I should use the web interface of Sage to avoid having to install R on the VM. Best regards, David On 10-07-14 10:24, Albyn Jones wrote:> Take a look at Sage, which is an open source alternative. It already > integrates R.... (http://www.sagemath.org) > > albyn > > Quoting David Bickel <davidbickel.com+rhelp at gmail.com>: > >> What are some effective ways to leverage the strengths of R and >> Mathematica for the analysis of a single data set? >> >> More specifically, are there any functions that can assist with any >> of the following? >> 1. Calling an R function from Mathematica. >> 2. Calling a Mathematica function from R. >> 3. Using XML or another reliable data format to pass vectors, >> matrices, and/or lists from one environment to the other. >> >> Any advice would be appreciated. >> >> David >> >> -- >> David R. Bickel, PhD >> Associate Professor >> Ottawa Institute of Systems Biology >> Biochem., Micro. and I. Department >> Mathematics and Statistics Department >> University of Ottawa >> 451 Smyth Road >> Ottawa, Ontario K1H 8M5 >> >> http://www.statomics.com >> >> Office Tel: (613) 562-5800 ext. 8670 >> Office Fax: (613) 562-5185 >> >> ______________________________________________ >> R-help at r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide >> http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> >> >