値を一致させてそれらをコーディングするこれがあなたの最初の質問を解決する一つの方法です。 私はあなたがしなければならない比較の数を減らすために行列演算を使っています。 他の人がこれを行うには良い方法があります。
Names Default To Here( 1 );
dt = New Table( "Example",
Add Rows( 2 ),
New Column( "Jan", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [11111, 33333] ) ),
New Column( "Feb", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [22222, 33333] ) ),
New Column( "March", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [11111, 44444] ) ),
New Column( "April", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [11111, 55555] ) ),
New Column( "May", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [11111, 11111] ) ),
New Column( "June", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [22222, 33333] ) ),
New Column( "July", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [11111, 22222] ) ),
New Column( "August",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [22222, 11111] ),
Set Display Width( 51 )
)
);
For( k = 1, k <= N Rows( dt ), k++,
theRow = dt[k, 0];
compare = theRow[1];
theRow = theRow - compare;
theLoc = Loc( theRow );
theRow = theRow + 1;
For( i = 1, i <= N Rows( theLoc ), i++,
theRow[theLoc[i]] = 0
);
theRow[1] = compare;
dt[k, 0] = theRow;
);
あなたの2番目の質問について......私はあなたが何について話しているのか少し混乱しています。 あなたのデータが今どのようになっているのか、そしてそれがどうなってしまうのか、という簡単な例を教えてください。
値を一致させてそれらをコーディングするようこそ @ Apurva14
この解決策を見てください。
正しい方向かどうかをお知らせください
New Table( "Untitled",
Add Rows( 4 ),
New Column( "Jan",
Set Values( [11111, 33333, 44444, 55555] )
),
New Column( "Feb ",
Set Values( [22222, 33333, 11111, 55555] )
),
New Column( "March",
Set Values( [11111, 44444, 22222, 11111] )
),
New Column( "April ",
Set Values( [11111, 55555, 33333, 33333] )
),
New Column( "May ",
Set Values( [11111, 11111, 44444, 55555] )
),
New Column( "June",
Set Values( [22222, 33333, 44444, 55555] )
),
New Column( "July ",
Set Values( [11111, 22222, 22211, 55555] )
),
New Column( "August",
Set Values( [22222, 1111, 44444, 22222] )
)
);
// here is where the work starts
dt = Current Data Table();
cols = dt << get column names( string );
ncols = N Items( cols );
For( i = 1, i <= ncols, i++,
Eval( Parse( "dt << new column (cols[i+1], Formula(" || Char( cols[1] ) || " ==" || Char( cols[i + 1] ) ) )
);
ベスト、
ロン
値を一致させてそれらをコーディングするあなたの2番目の質問に関して、以下を試してください:
New Table( "Untitled",
Add Rows( 4 ),
New Column( "Jan", Set Values( [11111, 33333, 44444, 55555] ) ),
New Column( "Feb ", Set Values( [22222, 33333, 11111, 55555] ) ),
New Column( "March", Set Values( [11111, 44444, 22222, 11111] ) ),
New Column( "April ", Set Values( [11111, 55555, 33333, 33333] ) ),
New Column( "May ", Set Values( [11111, 11111, 44444, 55555] ) ),
New Column( "June", Set Values( [22222, 33333, 44444, 55555] ) ),
New Column( "July ", Set Values( [11111, 22222, 22211, 55555] ) ),
New Column( "August", Set Values( [22222, 1111, 44444, 22222] ) )
);
// here is where the work starts
dt = Current Data Table();
dt2 = dt << Stack(
columns( :Jan, :Feb, :March, :April, :May, :June, :July, :August ),
Source Label Column( "Label" ),
Stacked Data Column( "Data" )
);
dt3 = dt2 << Summary(
Group( :Data ),
Freq( "None" ),
Weight( "None" )
);
dt2 << Update(
With( dt3 ),
Match Columns( :Data = :Data )
);
dt3 << close window (no save);
dt2 << Sort( By( :N Rows ), Order( Ascending ) , replace table);
// at this point the unique values should be at the top of the table
ベスト、
ロン
値を一致させてコーディングするそのため、私は月ごとに複数の列に同じ値(例:-12345)を持っています。最初の列の値を数値として保持し、残りが存在する場合または存在しない場合は0と1としてコーディングします。
私が持っているデータに関するもう一つのことは、いくつかの値はユニークであるということですが、それらは最初のコラムにはありません。
これは私のデータがどのように見えるのか
1月2月3月4月5月6月7月8月11111 22222 11111 11111 11111 22222 11111 22222 33333 33333 44444 55555 11111 33333 22222 1111など
例えば言う
111111 0 1 1 0 1 0私はそれがこれらのように見えることを望みます!
どんなスタッフでも大歓迎です@staff