JMPコミュニティの皆さん、こんにちは。
0〜100の範囲の整数を含む一連の列を用意します。列は常に0から始まり、特定の行番号から増加し始めます。すべて0の行を削除してから、ゼロ以外のセルをシフトアップするにはどうすればよいですか?また、同じシートのすべての列にそれを適用する必要があります。
例(「。」は空のセルを意味します)初期データ:
列1列2列3列
行-1 0 0 0
行2 0 0 0
行3 0 0 0
行4 1 0 1
列5 3 1 2
列6 8 4 7
操作後の最終結果:
列1列2列3列
行1 1 1 1
行2 3 4 2
行3 8。 7
行4。 。 。
行-5。 。 。
列6。 。 。
どうもありがとう!
スティーブ
以下は、各独立した列の値を上に移動するサンプルスクリプトです。 使用されるサンプルデータは、提供されたデータです。
Names Default To Here( 1 );
dt = New Table( "Example",
Add Rows( 6 ),
New Column( "Col 1",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Selected,
Set Values( [0, 0, 0, 1, 2, 3] )
),
New Column( "Col 2",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Selected,
Set Values( [0, 0, 0, 0, 1, 4] )
),
New Column( "Col 3",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Selected,
Set Values( [0, 0, 0, 1, 2, 7] )
),
Set Row States( [1, 1, 1, 1, 1, 1] )
);
colNames = dt << get column names( numeric, string );
For( i = 1, i <= N Items( colNames ), i++,
theMatrix = Column( colNames[i] ) << get values;
Column( colNames[i] )[Index( 1, N Rows( dt ) )] = .;
Column( colNames[i] ) << set values( theMatrix[Loc( theMatrix )] );
);