PureBytes Links
Trading Reference Links
|
Hi Patrick,
To be more concrete I attach a sample of the functions I use to
interface to Rfrom AFL.
R=CreateStaticObject("StatConnectorSrv.StatConnector");
if (StaticVarGetText("m")!="Init"){R.Init("R");
StaticVarSetText("m","Init"); }
function Re(sR) {return R.Evaluate(sR);}
function Ren(sR) {R.EvaluateNoReturn(sR);}
function iniA(xR){ Ren(xR+"=c(0)");}
function setE(xR,n,x){Ren(xR+"["+n+"]="+x);}
function getE(xR,n){ return Re(xR+"["+n+"]");}
function setA(xR,x){ R.SetSymbol(xR,x);}
function getA(xR){L=Re("length("+xR+")");//_TRACE("\nLLL L"+L);
for (i=1;i<=L;i++) {j=i-1;temp[j]=getE(xR,i); /*_TRACE(" j"+i+"temp
"+temp[j]);*/}return temp;}
Do you use the same approach of getA to transfer an array from R ro
AB(element by element)?
Do you have an equivalent of Re which uses the Evaluate method of the
com server andis quite useful since it allows to write code like
a=Re("r command returning something")?
Thanks again
Ly
--- In amibroker@xxxxxxxxxxxxxxx, "vlanschot" <vlanschot@xxx> wrote:
>
> Hi,
>
> The RMath plug-in has a fairly efficient routine for marshalling AFL
> vector data to SafeArrays in COM. This happens both on the way in
> and back out of RMath and so is hidden from the end user, making the
> code required very compact and simple.
>
> Of course, it may be possible to write code in AFL to do this
> manually (as pointed out in the manual), and it may be that this can
> be improved further by having a play around with the VBArray function
> in AFL to assist with this (if you don't want to use the plug in).
>
> Re potential upgrade, again this has not been decided yet*, but
> basically yes that is the idea.
>
> PS
>
> * If only because our intitial goal (i.e. access to R WITHIN AB) has
> been achieved, and this step would complicate matters in some
> aspects, like require the user to know how to operate R in its native
> environment.
>
> --- In amibroker@xxxxxxxxxxxxxxx, "loveyourenemynow"
> <loveyourenemynow@> wrote:
> >
> > Hello,
> >
> > and thank you for your answer.
> > I refer to the fact that in order to retrieve an array from R, this
> > has to be done element by element using the com server, since AB is
> > not accepting the R data type.
> > I wrote some AFL functions to do this, but I was wondering if the
> > plugin was somehow able to actually transfer data directly (which
> > would be much faster).
> > But if it using the com server I guess this is the only way.
> >
> > Regarding the new implementation,do u mean that some AFL variable is
> > constantly update with its R "sister", without the need to tranfer
> > data back and forth?
> >
> > Thanks
> > Ly
> >
> >
> >
> > --- In amibroker@xxxxxxxxxxxxxxx, "vlanschot" <vlanschot@> wrote:
> > >
> > > Hi Ly,
> > >
> > > First, which "problems" do you mean (or do you refer to endnote
> II in
> > > the RMath manual)?
> > >
> > > To answer your question: yes it does. And in terms of
> transferring
> > > data (e.g. vectors) to R via the plug-in, I have not encountered
> any
> > > limitation. In other words, I personally have no need for
> any "work-
> > > around".
> > >
> > > However, the current plug-in does not (yet) allow full two-way
> > > communication between R and AB, i.e. putting something in R which
> > > immediately becomes available in AB. We are looking (early stage)
> at
> > > possibly integrating another tool which would allow you to move
> back
> > > and forth like that between R and AB which, for example, would
> bypass
> > > the need for the debugger as you would see your results
> immediately
> > > within R.
> > >
> > > Hope this answers your question, if not you'll need to be more
> > > specific I'm afraid.
> > >
> > > PS
> > >
> > > --- In amibroker@xxxxxxxxxxxxxxx, "loveyourenemynow"
> > > <loveyourenemynow@> wrote:
> > > >
> > > > Hello Patrick,
> > > >
> > > > I would like to ask you if your plugin uses the R com server to
> > > > transfer data between R and AB.
> > > > I was doing that and wrote some simple functions to transfer
> > > vectors,
> > > > and I encountered the problems you mention in your
> documentation
> > > file,
> > > > but with some workaround it was working.
> > > >
> > > > I wonder if you are able to directly transfer vectors or you
> use
> > > some
> > > > similar workaround.
> > > >
> > > >
> > > > Thanks
> > > >
> > > > Ly
> > > > --- In amibroker@xxxxxxxxxxxxxxx, "vlanschot" <vlanschot@>
> wrote:
> > > > >
> > > > > Hello,
> > > > >
> > > > > This mail is to inform you that I have just uploaded the zip-
> file
> > > > > RPlugIn. It contains two files. The first is the file
> > > RMathAFL.dll,
> > > > > the RMath plug-in for AB. The second is the Word-document
> R_Plug-
> > > > > in_Amibroker.doc, the accompanying manual. The manual briefly
> > > > > describes the functionality of the RMath plug-in for
> Amibroker
> > > which
> > > > > I make freely available to all AB-users. Its purpose is to
> allow
> > > you,
> > > > > the AB-user, to efficiently interact with R, the open-source
> and
> > > > > freeware statistical/ mathematical package based on the S-
> > > language
> > > > > (i.e. S-Plus). For more details on R , please visit the
> official
> > > > > website: http://www.r-project.org/. Here you will also find
> > > manuals
> > > > > and other contributed papers on R. Specifically, see this web-
> > > page:
> > > > > http://www.stats.bris.ac.uk/R/.
> > > > >
> > > > > It is impossible to discuss the full scale of the R-
> functionality
> > > > > that the plug-in makes available to the AB-user. It simply is
> > > > > massive, and even I have only explored a tiny bit of it.
> Instead,
> > > the
> > > > > manual will describe a small subjective selection of the
> > > > > possibilities available, with the aim to get you going. I
> have no
> > > > > pretension that my examples are of any use to you. What I do
> > > hope,
> > > > > however, is that they can get you going, and that this plug-
> in
> > > will
> > > > > enhance your trading/analysis skills, like it has mine.
> > > > >
> > > > > The plug-in has been kindly developed by a programmer-friend
> for
> > > > > which I am very grateful (and no, it is not Tomasz). There
> will
> > > be NO
> > > > > technical support for it, and (in all likelihood) no
> upgrades, if
> > > > > only because the functionality embedded is:
> > > > > - very extensive and flexible in terms of accessing R's
> core
> > > > > functionality (I would say almost unlimited, particularly if
> you
> > > > > write your own R-functions separately in R, which
> subsequently
> > > can
> > > > > then be called from AFL);
> > > > > - unlikely to be (negatively) impacted by changes in R
> itself;
> > > > >
> > > > > In the manual you will read about my motivations to have this
> > > plug-in
> > > > > developed, the main one being to thank, first and foremost,
> > > Tomasz
> > > > > Janeczko for developing AB into what it is has become: an
> > > industry-
> > > > > standard investment and trading platform. It has enabled me
> to
> > > > > transform my investment thinking into practical applications,
> > > making
> > > > > some money along the way. Extended thanks go to the AB-
> community
> > > in
> > > > > general. I am very grateful to the guidance, sample code, and
> > > other
> > > > > help (including support from Marcin) I have received over the
> > > past
> > > > > few years.
> > > > >
> > > > > PS
> > > > >
> > > >
> > >
> >
>
------------------------------------
**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.
TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com
TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/amibroker/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:amibroker-digest@xxxxxxxxxxxxxxx
mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx
<*> To unsubscribe from this group, send an email to:
amibroker-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|