요약 테이블을 수정하려고합니다.
- 테이블은 Sub_name, Substrate_ID 및 Date 순으로 정렬되었습니다.
- 테이블을 검색하고 Sub_name이 중복 된 경우 Substrate ID가 중복되고 날짜가 1 일 이내 인 경우 해당 행을 결합합니다.
-이 값들은 자정을 지나는 값이므로 날짜가 달라서 별도의 줄이됩니다.
다음 코드를 시도 :
debug = RTDT << Summary(Group( :Sub_name, :Substrate_ID, :Date ),
Mean( :Runtime ),
Freq( "None" ),
Weight( "None" ),
);
debug << Sort( By(:Sub_name, :Substrate_ID ), Order(Ascending), Replace Table);
EOL = Nrows(debug);
for(i=1, i < (EOL), i++, Formula(
if((debug:Substrate_ID[i+1] == debug:Substrate_ID[i]) &
(debug:Sub_name[i+1] == debug:Sub_name[i]) &
((debug:Date[i+1] - debug:Date[i]) == 86400),
NewCount = :N Rows[i]+:N Rows[i+1];
:N Rows[i+1] = New Count;
NewTime = column(debug|"Mean(Runtime)")[i] + column(debug|"Mean(Runtime)")[i+1];
column(debug|"Mean(Runtime)")[i+1] = NewTime;
debug << slect row(i) << delete row,
);
);
어떤 도움을 주셔서 감사합니다.
두 번째로 요약 플랫폼을 사용하면 매우 간단하게 문제를 해결할 수 있다고 생각합니다.
Names Default To Here( 1 );
dt = Current Data Table();
dt << Summary(
Group( :Sub_name, :Substrate_ID ),
Max( :Date ),
Sum( :N Rows ),
Sum( :Name( "Mean(Runtime)" ) ),
Freq( "None" ),
Weight( "None" ),
statistics column name format( "column" ),
Link to original data table( 0 )
);