変数に格納されたリストを、Control Chart BuilderのYの列に読み込む複数のカラム名として定義したい。表題を実現するJSLスクリプトの書き方を考えています。
使用するJMPのバージョンは18を利用しています。
dt02=current data table();
//列名を変数に
columnNames = dt02 << Get Column Names;
//3列目以降の列はすべてトレンドを確認するために必要
columnNames2={};
For( j = 3, j <= N Items( columnNames ), j++,
Insert Into( columnNames2, Column( columnNames[j] ) );
);
//X-bar_and_S_chart作成
grp01=dt02<<CONTROL chart="" builder=""></CONTROL>Automation and ScriptingWindowsRe: 変数に格納されたリストを、Control Chart BuilderのYの列に読み込む複数のカラム名として定義したい。管理図ビルダーは、JMP の難しいプラットフォームの 1 つになりたいようです。このようなものがあれば、すべて (難しいものや面倒なものも) 機能させることができるはずです。
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
cont_cols = dt << Get Column Names("Continuous", String);
ys = Expr(Y());
For Each({colname}, cont_cols,
Insert Into(ys, Name Expr(AsColumn(dt, colname)));
);
Eval(Substitute(
Expr(ccb = dt << Control Chart Builder(
Variables(Subgroup(:age), _ycols_),
Show Control Panel(0),
Chart(Position(1), Limits(Sigma("Standard Deviation"), Spec Limits(1))),
Chart(Position(2), Points(Statistic("Standard Deviation")), Limits(Sigma("Standard Deviation"))),
Show Control Panel(0)
)),
Expr(_ycols_), Name Expr(ys)
));Re: 変数に格納されたリストを、Control Chart BuilderのYの列に読み込む複数のカラム名として定義したい。素敵なコードをどうもありがとう!
問題は完全に解決できました、感謝申し上げます。
正直申し上げて、コードはまだうまく理解できていません。。。
イメージとしては、ysに格納した配列で、都度substituteを行い、その結果をコントロールチャート内に格納するようなイメージであったと考えます。あっておりますでしょうか?
Re: 変数に格納されたリストを、Control Chart BuilderのYの列に読み込む複数のカラム名として定義したい。In most of the platforms you could use Eval() with list of columns but in case of control chart builder it doesn't work and you have to have very specific format to make it work Y(:col, :col2). I build the correct format into ys, Y(:height, :weight) and then use Substitute to add to the Control Chart Builder message so it will be "forced" to evaluate correctly. You can see this if you remove Eval() outside of the Substitute() and run that

Show(NameExpr(ys))を使ってysが何であるか確認することもできます。
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
cont_cols = dt << Get Column Names("Continuous", String);
ys = Expr(Y());
For Each({colname}, cont_cols,
Insert Into(ys, Name Expr(AsColumn(dt, colname)));
);
Show(Name Expr(ys)); // Name Expr(ys) = Y(:height, :weight);
Re: 変数に格納されたリストを、Control Chart BuilderのYの列に読み込む複数のカラム名として定義したい。Eval(Substitute(Expr(...)))のいずれか
... またはEval(Eval Expr( Expr()...))
ヒントとコツ - JMP/JSL のベスト プラクティス
Eval (Eval Expr( Expr()...))を次のように考えます。
全体を Eval() する前に、 Expr()とEval Expr() .... を検索してください。
残念ながら、これら 3 つはすべてE...で始まるため、正しい意味を覚えるのは少し難しいです。
4 番目のE... はName Expr()です - @jthi はこれを for ループで使用して、文字列を列 (:column) に変換しました *)
...そして、エラー メッセージの代わりにY(...)を取得する必要があります : )
*) Fortunately, Control Chart Builder accepts strings as alternative to columns.
したがって、列名のリストを、先頭を次のように置き換えることで、列名のY()に直接変換することができます。
代入する:
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
tmp = dt << Get Column Names("Continuous", String);
Substitute Into(tmp, Expr(List()), Expr(Y()));
Eval(Eval Expr(
ccb = dt << Control Chart Builder(
Variables(Subgroup(:age), Expr(Name Expr(tmp))),
Show Control Panel(0),
Chart(Position(1), Limits(Sigma("Standard Deviation"), Spec Limits(1))),
Chart(Position(2), Points(Statistic("Standard Deviation")), Limits(Sigma("Standard Deviation"))),
Show Control Panel(0)
)
));