JMP에서 큰 테이블로부터 벡터 열을 생성하는 가장 빠른 방법은 무엇입니까?
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class Families.jmp" );
// Data table summary
// → Data Table( "Summary of Big Class Families grouped by age etc." )
tmp = dt << Summary( Group( :age, :sex, :height, :weight ) );
// New formula columns
tmp << New Column( "Rank", Formula( Col Rank( 1, :age, :sex ) ) );
// Split data table
// → Data Table(
// "Split of Summary of Big Class Families grouped by age etc. by Rank[age]"
// )
final = tmp << Split( Split By( :Rank ), Split( :height, :weight ), Group( :age, :sex ) );
final << New Column( "heights",
Expression,
set each value(
Matrix( {:height 1, :height 2, :height 3, :height 4, :height 5, :height 6} )
)
);
final << New Column( "weights",
Expression,
set each value(
Matrix( {:weight 1, :weight 2, :weight 3, :weight 4, :weight 5, :weight 6} )
)
);
final << Delete Columns({:height 1, :height 2, :height 3, :height 4, :height 5, :height 6,:weight 1, :weight 2, :weight 3, :weight 4, :weight 5, :weight 6})
참고: 누락된 항목은 필요하지 않습니다.
제 생각에는 각 행에 대해 일치하는 행을 가져오는 루프를 사용하고 데이터 테이블 인덱싱을 사용하여 값을 가져오거나 설정하는 방식이 될 것 같습니다.