我试着用下面的代码可以求出这个结果。
请问专家是否有更快捷的方法?
谢谢!
I use Summarize() to get the unique keys
dt=open("$sample_data\big class.jmp"); summarize( dt, nn = by( column(2))); rh = n items(nn);
dt = Open( "$SAMPLE_DATA/Big Class.jmp" ); ar = dt << GetAsMatrix( 2 ); nn = Matrix( Associative Array( ar[0, 1] ) << getKeys ); rh = N Row( nn );
I often use Summary under Tables to get unique items. The pro is that we have good reasons to believe the underlying implementation is highly optimized. The con is that the approach has to generate a new table, which might be a non-negligible overhead.
dt = Open( "$SAMPLE_DATA/Big Class.jmp" ); sumdt = dt << Summary( Group( :age ), Freq( "None" ), Weight( "None" ) ); rh = nrow(sumdt); close(sumdt,nosave);
感谢专家的帮助。虽然这个答案不是我想要的。