用于转置现有数据表中数据的脚本你好,
我喜欢找一个脚本来转置数据。 此数据应插入到现有文件的最后一行。 按照我如何转置数据:
数据表( “快照 Abfrage AL2” ) <<转置(
列( :价值) ,
仅转置选定的行( 1 ) ,
输出表( “AL2 快照转置” )
) ;
数据表( “快照 Abfrage AL2” )
这样,JMP 就会在每次创建新数据表时复制数据。 如何将其复制到现有文件中(文件已打开)?
我的想法是选择转置行(“AL2 快照转置”)并将其复制到我的目标文件中。 但我找不到复制行值的命令。
回复:转置现有数据表中数据的脚本如果您有用于匹配列名的“:Tag”列,那么您的解决方案是更好的解决方案回复:转置现有数据表中数据的脚本感谢您的快速回复。
与此同时,我尝试了一些不同的东西。 因此我使用了“集中”功能:
//transponse table
Data Table( "pisnapshot Abfrage AL2" ) << Transpose(
columns( :value ),
Transpose selected rows only( 1 ),
Label( :tag ),
Output Table( "AL2 Snapshot Transpose" ));
//add Table "AL2 Snapshot Transpose" to exsiting table "AL2 Snapshot"
Data Table( "AL2 Snapshot" ) << Concatenate(Data Table( "AL2 Snapshot Transpose" ),Append to first table);
//close table with “no save”
Close(Data Table( "AL2 Snapshot Transpose" ), No Save);
而且效果很好。 但我会尝试你的解决方案。
回复:转置现有数据表中数据的脚本我认为下面的脚本是您所说的更简单的解决方案
Names Default To Here( 1 );
dt = Current Data Table();
// Get the selected rows
selRows = dt << get selected rows;
If( N Rows( selRows ) > 0,
// Add the row to place the data into
dt << Add Rows( 1 );
// Go from column to column and move the selected data to the new row
For( i = 1, i <= N Cols( dt ), i++,
Column( dt, i )[N Rows( dt )] = Column( dt, N Col( dt ) )[selRows[i]]
);
// Delete the last column
dt << delete columns( Column( dt, N Cols( dt ) ) );
);