안녕하세요 여러분,
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);잘 작동합니다. 하지만 한 가지 질문이 있습니다. 열 내부의 데이터만 이동하고 헤더는 이동하지 않는 것도 가능할까요? 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);