Subscribe Bookmark RSS Feed

How to Fit Y by X where Variables Cycle Through Certain Columns?


New Contributor


Jun 20, 2016

Hello everyone,

I am trying to figure out how to Fit Y by X, where Y cycles through all of my Numerical-Continuous columns ending in "_CODED" that have been produced earlier in the script. After every column has been used as Y for the first X, I'd like to have the next "_CODED" column be used as a new X, and have the Y columns be cycled through again, until all possible graphs have been produced, preferably in a single window instead of separate windows.

I am having trouble using a variable for the CODED columns in the Bivariate portion of the script, which is what I think I need to do, but everything I've tried so far has produced errors. Could someone look through what I have and try to help me with this?

dt = Data Table("");

cols = dt << get column names(Character); //List all character columns

For (i = 1, i <= N Items(cols), i++,

     one_col   = cols << get name;


     coded_col = one_col || "_CODED";

     col_expr = evalinsert(

"\[   dt << New Column("^coded_col^", Numeric, "Continuous",

Format("Best", 12), Formula(

                if (:name("^one_col^") == "PASS", 1,

                     :name("^one_col^") == "FAIL", 2,

                     :name("^one_col^") == "", 3,

                     :name("^one_col^") == "NOTTESTED", 4,

                     :name("^one_col^") == "IGNORE", 5,

                     :name("^one_col^") == "PASS|PASS", 6,

                     :name("^one_col^") == "IGNORE|IGNORE", 7,

                     :name("^one_col^") == "NOTTESTED|NOTTESTED", 8;








//That was all to produce new Numerical-Continuous columns out of the columns I have. Continuing the script, I am trying to create Y by X graphs of these new columns. I'm actually not quite sure what to do here..


  Y( (coded_col), 

  X( (coded_col),

  Fit Line( {Line Color( {213, 72, 87} )} )








Jun 23, 2011

Not sure I understood your intention exactly, but FYI, you can do this kind of thing:


// Sample Data

dt = NewTable("Data",

NewColumn("Not X", Numeric, Continuous, Formula(RandomInteger(0, 3))),

NewColumn("Not Y", Numeric, Continuous, Formula(RandomInteger(0, 3))),



For(c=1, c<=5, c++,

dt << NewColumn("VAR"||Char(c)||"_CODED", Numeric, Continuous, Formula(RandomNormal()));


// Get all the columns in the table dt . . .

cols = dt << getColumnNames("String");

// Retain only the columns we want

For(c=NItems(cols), c>=1, c--,

If(!EndsWith(cols[c], "_CODED"), RemoveFrom(cols, c));


// Launch the platform (makes 5 x 5 = 25 plots)

biv = dt << FitYByX(X(Eval(cols)), Y(Eval(cols)));