I'm trying to write a script to change all the columns with the word "Mean" in their header to numeric data type and continuous modeling type.
I'm getting the error that "Send Expects Scriptible Object" regarding the last line "cols << data type("numeric")". How would I fix my code? Or is there an easier way to accomplish the same task?
cols = dt << get column names( string );
For( i = N Items( cols ), i>=1, i--,
If( Contains( cols[i], "Mean" ),
cols << data type("numeric");
)
);I'm using JMP Pro 16. Thanks!
You are sending the message to wrong variable. Something like
cols = dt << get column names(string);
For(i = N Items(cols), i >= 1, i--,
If(Contains(cols[i], "Mean"),
Column(dt, cols[i] << data type("numeric")
)
);
should work. I would also rewrite the script a little (use For Each and << Set Data Type) as I think those are easier to read
cols = dt << get column names("String");
For Each({col}, cols,
If(Contains(col, "Mean"),
Column(dt, col) << Set Data Type("Numeric");
);
);
You are sending the message to wrong variable. Something like
cols = dt << get column names(string);
For(i = N Items(cols), i >= 1, i--,
If(Contains(cols[i], "Mean"),
Column(dt, cols[i] << data type("numeric")
)
);
should work. I would also rewrite the script a little (use For Each and << Set Data Type) as I think those are easier to read
cols = dt << get column names("String");
For Each({col}, cols,
If(Contains(col, "Mean"),
Column(dt, col) << Set Data Type("Numeric");
);
);
Thanks! That second script works great.