AllCols = dt << Get Column Names();
AllColNames = dt << Get Column Names(string);
for(i=3, i<=n items(AllCols), i++,
colcol = AllCols[i];
cname = AllColNames[i];
nnm1 = Col Number(colcol);
Fstr = "num(:\!""||cname||"\!"n)";
Fexpr = parse(Fstr);
newcol = dt << new column("Temp", numeric, formula(eval(evalexpr(Fexpr))));
nnm2 = Col Number(newcol);
if(nnm2 == nnm1,
newcol << delete formula();
dt << Delete Columns(colcol);
newcol << set name(cname), //else
dt << Delete Columns(newcol);
);
);
I am using JMP18 on Windows. When I write code that I want to use often, I like to make a toolbar button for it. But sometimes I find that code that is acceptable to run from an open script window is not acceptable when run from a toolbar icon. Here is an example, where I am looping through columns and changing them from character to numeric if all entries are numeric. When running from a toolbar the objection is for the line:
newcol = dt << new column("Temp", numeric, formula(eval(evalexpr(Fexpr))));
This syntax is acceptable when I run from a script window!
Why would the jsl interpreter be different in each situation?
What syntax for this would be universally acceptable?
For very large datasets and columns this can be slow. Is there a better way to do this?