皆さんこんにちは、
刈り取られたシーケンスの行数を取得する必要がありますグループ化データ、たとえば次の形式の列データ:
aaabbbbbccaaadddbbb ...
Summary Statisticsオプションを使用し、この列でグループ化すると、合計の各値の出現回数あいうえお (N行):6,8,2,3。必要なのは、各グループの行数です順番に別々に :
a、b、c、a、b、d(N行):3,4,2,3,3,3
何か案が?
おかげで、
-ディーン
私の提案は、次の数式を使用して新しい数式列を作成することです。
If( Row() == 1, counter = 0 );
If( Lag( :yourgrouppedcolumnname ) != :yourgrouppedcolumnname,
counter++,
counter
);
counter;
「yourgrouppedcolumnnmae」を、繰り返し列を持つ実際の列名に置き換えます。
次に、概要プラットフォームを実行できます
テーブル==>概要
新しい列に追加すると、各グループのカウントが表示されます。
結果を元のテーブルに戻す必要がある場合は、元のデータテーブルでUpdate Platformを使用し、Summaryテーブルをポイントして、作成した新しい列で照合するだけです。
以下は、Big Classサンプルデータテーブルを使用したサンプルスクリプトです。
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/big class.jmp" );
// Create the new binning column based upon the "Sex" column
dt << New Column( "Bin",
formula(
If( Row() == 1, counter = 0 );
If( Lag( :Sex ) != :Sex,
counter++,
counter
);
counter;
)
);
// Calculate the counts of the new binning column
dtSummary = dt << Summary(
Group( :Bin ),
Freq( "None" ),
Weight( "None" ),
Link to original data table( 0 )
);
// Move the counts into the original data table
dt << Update( With( dtSummary ), Match Columns( :Bin = :Bin ) );
