|
[Date Index]
[Thread Index]
[Author Index]
Re: How to use R within Mathematica
- To: mathgroup at smc.vnet.net
- Subject: [mg100870] Re: How to use R within Mathematica
- From: Erich Neuwirth <erich.neuwirth at univie.ac.at>
- Date: Tue, 16 Jun 2009 21:54:48 -0400 (EDT)
- References: <gr0glf$96a$1@smc.vnet.net> <h0vtov$79r$1@smc.vnet.net> <h12gh6$ee3$1@smc.vnet.net>
Some more remarks.
> myR = CreateCOMObject["StatConnectorSrv.StatConnector"]
There is a foreground server and a background server.
For the foreground server you have to have a running RGui (or RTerm)
with library rcom loaded.
Then
>> myR = CreateCOMObject["RCOMServerLib.StatConnector"]
will allow you to "talk" to RGui from Mathematica and then switch
windows and work within RGui.
What you are doing gives you a background server.
You cannot access this server except from Mathematica.
There is no RGui "backdoor", which is very useful for debugging.
I am still fixing a few loose ends before this will go public.
BTW: I already can get R graphics into Mathematica, and they are
embedded like Mathematica graphics.
So far, I found no reasonable vector graphics format which R can write
and Mathematica can Import. Any suggestions to that respect?
Mark Fisher wrote:
> On Jun 13, 6:07 am, Erich Neuwirth <erich.neuwi... at univie.ac.at>
> wrote:
>> I stumbled upon your question.
>> On Windows, it is easy to use R from within Mathematica.
>> You just have to download and install the
>> statconnDCOM server (free for noncommerial use)
>> from rcom.univie.ac.at
>>
>> The following piece of code shows how you than
>> can use R from within Mathematica.
>>
>> Needs["NETLink`"]
>> myR = CreateCOMObject["RCOMServerLib.StatConnector"]
>> myR@Init["R"]
>> myR@SetSymbol["xxx",12321]
>> result1=myR@GetSymbol["xxx"]
>> myR@EvaluateNoReturn["randmat<-matrix(rnorm(100),10)"]
>> rmat=myR@GetSymbol["randmat"]
>> result2=myR@Evaluate["solve(matrix(1:4,2))"]
>>
>> Dobromir Tzotchev wrote:
>>> I would like to use functions from some R libraries within Mathametica.=
> I have seen that there exists a software called RLink but it is not readil=
> y available. Is the way to go to use the R functionaly in C/C++ and t=
> hen use MathLink to call the C/C++ functions?
>>> Thanks.
>>
>
> Very interesting. I just downloading and installed RAndFriends from
> rcom.univie.ac.at, which installs R, rcom, rscproxy, statconnDCOM, and
> RExcel (I canceled the installation when I got to RExcel).
>
> I order to run your code, I had to modify it as follows:
>
> myR = CreateCOMObject["StatConnectorSrv.StatConnector"]
>
> You example illustrates a number of methods, such as SetSymbol,
> Evaluate, etc. I was able to infer
>
> myR@Close[]
>
> (and then use ReleaseCOMObject[myR]).
>
> Do know where I might find the full set of methods?
>
> --Mark
>
>
Prev by Date:
Re: mergeSort with ReplaceRepeated
Next by Date:
Re: FITS format and Mathematica 6
Previous by thread:
Re: How to use R within Mathematica
Next by thread:
ParallelTable[ ]
|