제목 : Re : 일치하는 값 및 코딩첫 번째 질문을 해결하는 한 가지 방법이 있습니다. 각 행에 대해 각 열을 아래로 이동하여 각 셀을 비교할 경우 행 수를 비교하기 위해 행렬 연산을 사용하고 있습니다. 다른 사람들은이 일을 더 잘 수행 할 수 있습니다.
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;
);
두 번째 질문에 관해서 ... 나는 당신이 말하는 것에 대해 약간 혼란스러워합니다. 데이터가 어떻게 생겼는지에 대한 간단한 예를 보여 주시겠습니까?
제목 : Re : 일치하는 값 및 코딩환영 @ 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] ) ) )
);
베스트,
론
제목 : Re : 일치하는 값 및 코딩두 번째 질문과 관련하여 다음을 시도하십시오.
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나는 이것들을 보길 원한다 !!
어떤 도움을 주시면 감사하겠습니다.