JMP 用戶您好,
我想使用 JSL 更新設定檔中的列名稱,並製作在標題和軸中包含更新的列名稱的繪圖。 我正在尋找如何做到這一點的想法。
我附上到目前為止的程式碼和表格。 謝謝您的幫忙。
我已附上我希望最終圖表的樣子(desired_Bivariate)
-西蒙
Names Default To Here( 1 );
dt = Open( "table_1.jmp" );
dt1 = Open( "config_table.jmp" );
dt1 << New Column( "New Column", character, formula( Column_name || "_" || additional_name ) );
graph = dt << Bivariate( Y( :height ), X( :id ) );
以下是解決該問題的兩種不同方法,它們不會更改列的實際名稱,但可以完成您所要求的任務。第一個建立具有為二元變數運行指定的新名稱的轉換列。這些列僅針對二元執行而存在。

第二個範例對資料表中的不同欄位使用單位列屬性。JMP 中的平台尊重「單位」列屬性,並將其顯示為實際列名稱的附加內容,方法是將「單位」值放在列名稱後面的() 中...(即「高度(英尺)”)

// This version of the script used Transform variables
// to temporarially change the name of the column just
// for the running of the Bivariate
Names Default To Here( 1 );
dt = Data Table( "table_1" );
dt1 = Data Table( "config_table" );
// Loop across the columns to run the Bivariate
For( i = 2, i <= N Cols( dt ), i++,
// Check to see if a column name change is specified
// in the config table
foundRow = dt1 << get rows where(
:Column_name == Column( dt, i ) << get name & dt1
:additional_name != ""
);
// If a column name change is found make the change
If( N Rows( foundRow ) > 0,
Eval(
Substitute(
Expr(
Bivariate(
Y(
Transform Column(
__trans__,
Formula( __col__ )
)
),
X( :id )
)
),
Expr( __trans__ ),
dt1:Column_name[foundRow[1]] || "_" || dt1
:additional_name[foundRow[1]],
Expr( __col__ ),
Parse( ":" || dt1:Column_name[foundRow[1]] )
)
),
// otherwise just run the bivariate
dt << Bivariate( Y( Column( i ) ), X( :id ) )
);
);
// This version of the script takes advantage of the Units
// column property. It will automatically add (unit value) to
// the display output, without actually changing the columns
// name
Names Default To Here( 1 );
dt = Data Table( "table_1" );
dt1 = Data Table( "config_table" );
// Add the Units Column Property to the columns in the
// original data table
For( i = 1, i <= N Cols( dt ), i++,
foundRow = dt1 << get rows where(
:Column_name == Column( dt, i ) << get name & dt1
:additional_name != ""
);
If( N Rows( foundRow ) > 0,
column( dt, i ) << set property("units", eval(dt1:additional_name[foundRow[1]]));
);
);
// Now run the normal bivariates
For( i = 2, i <= N Cols( dt ), i++,
dt << Bivariate( Y( Column( i ) ), X( :id ) )
);
嘗試這個:
Names Default To Here( 1 );
dt = Open( "table_1.jmp" );
dt1 = Open( "config_table.jmp" );
for(i = 1, i <= N Rows(dt1), i++,
x = Column(dt1, "Column_name")[i];
y = Column(dt1, "additional_name")[i];
Column(dt, i) << Set Name( x || "_" || y);
);