Eval Expr が機能しないいつもこの方法では混乱してしまいます。以前うまくいった方法をベースにこの方法を作成しました。
// Get the current data table
dt = Current Data Table();
colNames = dt << get column names( continuous, string );
// Loop through all columns
For each( {col}, colNames,
Eval(
Eval Expr(
New Column(
Expr( col ) || "_Gouge",
Numeric,
"Continuous",
Format( "Best", 10 ),
Formula( (Mean( As Column( Eval(col) ) [Index(1, 100)]) + Mean(As Column(Eval(col)) [Index(N Rows() - 99, N Rows())])) / 2 - Col Minimum(As Column(Eval(col)) ) )
);
)
);
);
数式は未評価のままであるようです。
自動化とスクリプトRe: Eval Expr が機能しないAs Column( Eval( col) ) は As Column( Expr( col) ) にする必要があります。
Re: Eval Expr が機能しない完成品はこんな感じです。
// Get the current data table
dt = Current Data Table();
colNames = dt << get column names( continuous, string );
// Loop through all columns
For each( {col}, colNames,
Eval(
Eval Expr(
New Column(
Expr( col ) || "_Gouge",
Numeric,
"Continuous",
Format( "Best", 10 ),
Formula( (Mean( As Column( Expr( col ) ) [Index(1, 100)]) + Mean(As Column( Expr( col ) ) [Index(N Rows() - 99, N Rows())])) / 2 - Col Minimum(As Column( Expr( col )) ) )
);
)
);
);
Re: Eval Expr が機能しない以下のコードを使用することもできます。このコードを使用すると、数式エディタで列が追加されたかのように見える列参照が作成されます。
利点の1つは、入力列の名前が変更されても、数式が引き続き機能することです。
dt = Current Data Table();
colNames = dt << get column names( continuous, string );
// Loop through all columns
For each( {col}, colNames,
Eval(
Eval Expr(
New Column(
col || "_Gouge",
Numeric,
"Continuous",
Format( "Best", 10 ),
Formula( (Mean( Expr(Name Expr(As Column( col ) )) [Index(1, 100)]) + Mean(Expr(Name Expr(As Column( col ) )) [Index(N Rows() - 99, N Rows())])) / 2 - Col Minimum(Expr(Name Expr(As Column( col )) )) )
);
)
);
);