发布日期: 08/07/2020

Transpose a Data Table

Transpose creates a new data table by flipping a data table on its side, interchanging rows for columns and columns for rows. If you specify no rows, Transpose() uses the selected rows. If no rows are selected, it uses all rows.

dt << Transpose(
	"private", "invisible",
	columns( columns ),
	Rows( row matrix ),
	By ( column ),
	Label column name( "name" ),
	Output Table( "name" )
);
dt << Transpose(
	Columns( columns ),
	Rows( row matrix ),
	Output Table Name( "name" )
);

The following example transposes the height and weight columns in the Big Class.jmp sample data table:

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
tranDt = dt << Transpose( Columns( :height, :weight ),
	Output Table Name( "Transposed Columns" ) );

Note: The simple transpose command dt << Transpose brings up the Transpose window. If you do not want the window to appear, invoke the transpose as dt << Transpose(no option).

需要更多信息?有问题?从 JMP 用户社区得到解答 (community.jmp.com).