回复:转置非特定数据列当您知道要转置的列的名称时,可以使用 eval 在 Transpose(columns()) 中使用它们
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
cols_to_transpose = {"height", "weight"};
dt_transposed = dt << Transpose(
columns(Eval(cols_to_transpose)),
Label column name("name"),
Output Table("Transpose of Big Class")
);回复:转置非特定数据列这是一个 Transpose 脚本示例,它检查数据表中的数据并根据数据生成转置数据表;
Names Default To Here( 1 );
theTranspose = Expr(
dt = Current Data Table();
// Get the first character column to use as the Label
theLabel = (dt << get column names( string, character ))[1];
// Get the numeric columns. All numeric columns will be transposed
theTransColumns = dt << get column names( string, numeric );
// Transpose the data
dt << Transpose( columns( theTransColumns ), Label( As Column( theLabel ) ) );
);
// Open Data Table: Big Class.jmp
// → Data Table( "Big Class" )
Open( "$SAMPLE_DATA/Big Class.jmp" );
theTranspose;
// Open Data Table: Blood Pressure.jmp
// → Data Table( "Blood Pressure" )
Open( "$SAMPLE_DATA/Cities.jmp" );
theTranspose;
我确信这不能解决您的具体问题,但是,不知道您没有指定您想要转置的规则,我将规则设置为所有找到的数字列都将被转置,并且第一个字符列找到将包含新的列名。
转置非特定数据列大家好,
我正在 jsl 中创建一个脚本,但在转置表时遇到问题,因为需要指定所需的列。 但是,就我而言,列取决于数据,因此它正在发生变化。
如何创建可以转置非特定数据列的 jsl 脚本?
自动化和脚本编写