연관 배열을 사용하여 열 이름 바꾸기안녕하세요, 연관 배열을 사용하여 여러 열의 이름을 바꾸려고합니다. 저는 Big Class 데이터를 예로 사용했습니다. 스크립트 수정에 도움을 주시면 감사하겠습니다.
Names Default To Here( 1 );
dt = Data Table ("Big Class.jmp");
//Use and array to rename the Big Class table columns to "spanish"
newColNames = Associative Array();
newColNames["name"] = "nombre";
newColNames["age"] = "edad";
newColNames["sex"] = "sexo";
newColNames["height"] = "altura";
newColNames["weight"] = "peso";
uno = newColNames << Get Keys(); //for testing
newN = newColNames << Get Values({"name"}); //for testing
oriNames = dt << Get Column Names(); // in case there are variation on the number/name of columns
For( i=1, 1 <= N Items(oriNames), i++,
key = oriNames[i];
Column(dt, key ) << set name (newColNames<<GET values=""></GET>데이터 테이블스크립팅Re : 연관 배열을 사용하여 열 이름 바꾸기당신은 매우 가까웠습니다.
Names Default To Here( 1 );
dt = Open("$SAMPLE_DATA/Big Class.jmp");
//Use and array to rename the Big Class table columns to "spanish"
newColNames = Associative Array();
newColNames["name"] = "nombre";
newColNames["age"] = "edad";
newColNames["sex"] = "sexo";
newColNames["height"] = "altura";
newColNames["weight"] = "peso";
oriNames = dt << Get Column Names("String"); // in case there are variation on the number/name of columns
For( i=1, i <= N Items(oriNames), i++,
key = oriNames[i];
Column(dt, key ) << set name ( newColNames << Get Value (key) );
); Re : 연관 배열을 사용하여 열 이름 바꾸기헉 "1"을보기에는 너무 오래 걸렸습니다!
dt = Open( "$sample_data/Big Class.jmp" );
//Use and array to rename the Big Class table columns to "spanish"
newColNames = Associative Array();
newColNames["name"] = "nombre";
newColNames["age"] = "edad";
newColNames["sex"] = "sexo";
newColNames["height"] = "altura";
newColNames["weight"] = "peso";
uno = newColNames << Get Keys(); //for testing
newN = newColNames << Get Values( {"age"} ); //for testing
oriNames = dt << Get Column Names( "string" ); // in case there are variation on the number/name of columns
For( i = 1, i <= N Items( oriNames ), i++,
key = oriNames[i];
Column( dt, key ) << set name( newColNames[key] );
);