JMP テーブルから 2 番目に大きい数値を抽出しようとしています。 これまでのところ、私は手動でのみ行ってきました
降順で並べ替え( Eval List( {:X1, :X2, :X3}));
個々の列名ではなくテーブル全体を渡すにはどうすればよいですか?

IF() 関数の比較コンポーネントにロジックの問題があります。
If( (Abs( colMax )) > 300 | (Abs( colMax )) > 250
> 250 の値は比較を真にするため、>300 は必要ありません。
比較は次のようにする必要があります。
If( ( Abs( colMax ) > 250,
193 という値を取得する理由を尋ねますか?これは、出力される値が列の 2 番目に高い値であり、フィルタリングが列の最大値に基づいているためです。2 番目に高い値は、任意の値にすることができます。列に次の値がある場合
列の最大値は 600 であるため、Max Col() > 250 の IF() 句を渡し、列の 2 番目に高い値は 193 です。
「」についてのご質問について2 番目に高い値、つまり colSecondMaxValues の行番号を見つけるにはどうすればよいですか?" という方法は、既にスクリプトに含まれています。ステートメント
maxRows = dt << get rows where( As Column( dt, colNamesList[i] ) == colMax );
列に最大値がある行の行番号の行列を返します。2 番目に高い値の行番号が必要な場合は、2 番目の最大値に等しい行を取得するだけです。したがって、Insert Into() 関数の後にこのステートメントを追加すると、2 番目に高い値を持つ行が取得されます。
Show(
dt << get rows where(
As Column( dt, colNamesList[i] ) == Col Max( Column( dt, colNamesList[i] ) )
)
);
ここに完全なコードがあります
dt = Open( "$SAMPLE_DATA/semiconductor capability.jmp" );
colNamesList = dt << get column names( string, continuous, numeric );
colSecondMaxValues = {};
// Loop across all continuous columns and find the Max value in
// a column, delete that value, and then find the second max value
// finally, replace the old values, and save the results
For( i = 1, i <= N Items( colNamesList ), i++,
colMax = Col Max( Column( dt, colNamesList[i] ) );
If( Abs( colMax ) > 250,
maxRows = dt << get rows where( As Column( dt, colNamesList[i] ) == colMax );
Show( maxRows );
Column( dt, colNamesList[i] )[maxRows] = .;
Insert Into( colSecondMaxValues, Col Max( Column( dt, colNamesList[i] ) ) );
Show(
dt << get rows where(
As Column( dt, colNamesList[i] ) == Col Max( Column( dt, colNamesList[i] ) )
)
);
Show( colSecondMaxValues );
Column( dt, colNamesList[i] )[maxRows] = colMax;
);
);@ih申し訳ありませんが、テーブル全体ではなく、すべての列の値が必要です。
@txnelsonスクリプトをありがとう。 このスクリプトで 300 または 250 を超える条件を機能させようとしていますが、なぜ 193 のような値を使用するのか理解できません。 また、2 番目に高い値、つまり colSecondMaxValues の行番号を見つけるにはどうすればよいですか? ご助力ありがとうございます。
dt=open("$SAMPLE_DATA/semiconductor capability.jmp");
colNamesList= dt<<GET column="" names=""> 300 | (abs(colMax)) > 250,
maxRows = dt<<GET rows="" where=""></GET></GET>テーブル全体で 2 番目に大きい値が必要な場合は、それがどの列にあるかに関係なく、次のようにします。
Names default to here(1);
dt = open( "$SAMPLE_DATA/semiconductor capability.jmp" );
//Find the two largest values in the entire table
Sort Descending(Shape(dt << Get all columns as matrix(),1))[{1, 2}];
//Or, to exclude character columns
Sort Descending(Shape(dt << Get as matrix(dt << get column names(numeric)),1))[{1, 2}];これは、データ テーブル内のすべての連続する列で 2 番目に高い値を決定する、私が書いた小さなスクリプトです。
names default to here(1);
dt=open("$SAMPLE_DATA/semiconductor capability.jmp");
colNamesList= dt<<GET column="" names=""></GET>