Subscribe Bookmark RSS Feed

Scripting: how to close an analysis within a For loop?

sornasst

Community Trekker

Joined:

Feb 2, 2016

In the simple script below, how can I close each of the Bivariate analysis after I capture its report?

Names Default to Here (1);

dt = Current Data Table ();

m = {};

m1 = [];

m2 = [];

For (i=6, i<= N Col (dt), i++,

            bv = Bivariate(

                  Y( Column (i)),

                  X( :mRSS ),

                  Density Ellipse( 0.95, {Line Color( {213, 72, 87} )} ),

                  invisible

            );

           

            bvr = bv << report;

                           insert into (m, Column Name (i));

            m1 = m1 || bvr [Outline Box (1)] [ Number Col Box (3)] [1];

            m2 = m2 || bvr [Outline Box (1)] [ Number Col Box (4)] [1];

      );

     

New Table ("CORRELATION",

      New column ("Symbol", character, set values (m)),

      New column ("Correlation", numeric, set values (m1)),

      New column ("P Value", numeric, set values (m2)),

);

1 ACCEPTED SOLUTION

Accepted Solutions
Solution

bv << close window;

4 REPLIES
Solution

bv << close window;

txnelson

Super User

Joined:

Jun 22, 2012

MS is correct, however, other issues exist in your script.  I have taken the liberty to modify your script to make it work

Names default to here(10);

dt = Current Data Table ();

m = {};

m1 = [];

m2 = [];

For (i=6, i<= N Col (dt), i++,

            bv = Bivariate(

                  Y( Column (i)),

                  X( :mRSS),

                  Density Ellipse( 0.95, {Line Color( {213, 72, 87} )} ),

                  invisible

                 

            );

          

            bvr =report( bv );

                           insert into (m, Column Name (i));

            m1 = m1 || ((bvr [Outline Box (1)] [ Number Col Box (3)])<<get) [1];

            m2 = m2 || ((bvr [Outline Box (1)] [ Number Col Box (4)])<<get) [1];

            bv << close window;

      );

    

New Table ("CORRELATION",

      New column ("Symbol", character, set values (m)),

      New column ("Correlation", numeric, set values (m1)),

      New column ("P Value", numeric, set values (m2)),

);

Jim
sornasst

Community Trekker

Joined:

Feb 2, 2016

Hi Jim,

Thanks for cleaning up my simple script. Could you explain to me how the "<< get" command works? I noticed that my simple script worked well by simply adding the "bv << close window" command and leaving out the "<< get" command.

Also, you wrote  "Names default to here(10);" I have to admit that I have always left this command with the value 1 without thinking that it could be a larger number. What does the "10" value do to the script?

Thank you for your help.

Sincerely,

Thierry

txnelson

Super User

Joined:

Jun 22, 2012

I will first explain the "Names Default to Here(10);"  Quite simply, it is a typo.  It should be a "1".

The "<< get" is the message, when sent to the object it is pointing to, to retrieve the values.

     bvr [Outline Box (1)] [ Number Col Box (3)])<<get

retrieves Number Col Box(3)'s column of numbers into a list.


It is a similar to the form of retrieving the text from Outline Box(1) by specifying:

     bvr [Outline Box (1)]<<get title

Jim