連想配列を使用して列の名前を変更するこんにちは、私は連想配列を使用して列の束の名前を変更しようとしています。 私は例としてビッグクラスのデータを使用しています。 スクリプトの修正にご協力いただければ幸いです。
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) );
);