こんにちは、みんな、
JMP で使用されている CSV ファイルがあります。ただし、列 1 と 2 を列 7 と 8 と交換する必要があります。JSL を使用してこれを行う方法は次のとおりです。次のようになります。
オリジナルファイル
列の入れ替え
データを移動するのではなく、ヘッダー名を変更するか、実際にデータを移動することができます。以下の例を参照してください。
names default to here(1);
dt =
// Open Data Table: Big Class.jmp
// → Data Table( "Big Class" )
Open( "$SAMPLE_DATA/Big Class.jmp" );
// Move header is easier than moving all of the data
:weight << set name("new name");
:height << set name("weight");
// One way to move data
theHeights = :weight << get values;
theWeights = :new name << get values;
:new name << set name("height");
:weight << set values(theWeights);
:height << set values(theHeights);これはうまく機能します。しかし、1 つだけ質問があります。列内のデータのみを移動し、ヘッダーを移動しないことも可能ですか? JSL を使用してどのように実行しますか?
列の順序を変更したいですか、それとも列内のデータを移動したいですか? これは列の順序を変更するのに役立ちますが、JMPのすべてのバージョンで同じように機能するわけではありません。
Names Default To Here(1);
dt = New Table("Untitled 2",
Add Rows(0),
Compress File When Saved(1),
New Column("1", Numeric, "Continuous", Format("Best", 12), Set Values([])),
New Column("2", Numeric, "Continuous", Format("Best", 12), Set Values([])),
New Column("3", Numeric, "Continuous", Format("Best", 12), Set Values([])),
New Column("4", Numeric, "Continuous", Format("Best", 12), Set Values([])),
New Column("5", Numeric, "Continuous", Format("Best", 12), Set Values([])),
New Column("6", Numeric, "Continuous", Format("Best", 12), Set Values([])),
New Column("7", Numeric, "Continuous", Format("Best", 12), Set Values([])),
New Column("8", Numeric, "Continuous", Format("Best", 12), Set Values([])),
New Column("9", Numeric, "Continuous", Format("Best", 12), Set Values([]))
);
wait(1); // demo purposes
collist = dt << Get Column Names("String");
col_order = {"7", "8", "3", "4", "5", "6", "1", "2", "9"};
dt << Move Selected Columns(col_order);