Thanks.
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))"]
It seems like the actual COM object should be different. I had success
with
myR = CreateCOMObject["StatConnectorSrv.StatConnector"]
--Sasha
> 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=
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
http://www.scienceops.com/Rlink2.asp
However it is not a free application.... though its cost is very
reasonable....
Hope this helps.
--David
http://scientificarts.com/worklife
Well, whatever, going to my question:
How can I write a fits file with my own header?
This does not work:
header=Import["file1.fits","Metadata"];
data=Table[0.,{10},{10}];
Export["test.fits",data,"Metadata"->header]
where the variable "header" is the "Metadata" of another fits file
Actually, I can not export any fits file with a header different
respect to the default one. (You can examine the header of a fits file
in a text editor)
Maybe "Metadata" is not an "Element" of the file..?? but:
Import["file1.fits","Elements"]
{"Airmass", "Author", "BitDepth", "ColorSpace", "Comments", "Data", \
"DataType", "Declination", "Device", "Equinox", "ExposureTime", \
"Graphics", "History", "HourAngle", "ImageSize", "Metadata", \
"Object", "ObservationDate", "Observer", "Organization", "Plaintext", \
"Range", "RawData", "Reference", "RightAscension", "SiderealTime", \
"TableData", "TableHeaders", "TableUnits", "Telescope"}
Thanks in advance for any help.
Atte. Andres Guzman
$Version 6.0 for Microsoft Windows (32-bit) (February 7, 2008)
$System
ps. by the way, these features where handled (not very neatly, but
effectively) in version 5.2 with ConversionOptions->{"Verbose"->True}
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
--
Murray Eisenberg mur...@math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower phone 413 549-1020 (H)
University of Massachusetts 413 545-2859 (W)
710 North Pleasant Street fax 413 545-1801
Amherst, MA 01003-9305
I generally think that academic, non-commercial, non-profit, and
retirees should have a 30% or greater discount on software....
That's my general policy for what I do for Mathematica packages and
consulting.
Perhaps scienceops would respond positively to this if asked..
Best,
David
On Jun 15, 5:37 am, Murray Eisenberg <mur...@math.umass.edu> wrote:
> For my own personal use, or for non-commercial academic use, I do not
> find the listed cost of RLink as "very reasonable" -- especially given
> that some of its crucial functionality can be achieved for free using
> the sort of code that Eric Neuwirth posted in this group ().
>
> David Reiss wrote:
> > RLink is readily available at
>
> >http://www.scienceops.com/Rlink2.asp
>
> > However it is not a free application.... though its cost is very
> > reasonable....
>
> > Hope this helps.
>
> > --David
>
> >http://scientificarts.com/worklife
>
> --
> Murray Eisenberg mur...@math.umas=
s.edu
> Mathematics & Statistics Dept.
> Lederle Graduate Research Tower phone 413 549-1020 (H)
> University of Massachusetts 413 545-2859 (=
I also use FITS data. However, I read FITS files with Import [], i.e., I
have never tried to write with Export[]. Nevertheless, I would offer a guess
that you need to do the following based on experience with some other
formats I have used for Export:
Export["test.fits",{"Data"->data,"Metadata"->header}]
If you try this and it works, I can explain why (I certainly have found the
Export syntax confusing at times myself).
Best, Scot
> 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?