將表格中的所有數字列製表你好,
我正在嘗試創建一個包含所有數字列(然後是另一個包含分類列)的製表表。
我嘗試運行它,但它不起作用。
有什麼建議嗎?
TIA
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
NumericCols = {};
for(i = 1, i <= N Cols(dt), i++,
Col = Column(dt,i);
ColDataType = Col << Get Data Type;
If( ColDataType == "Numeric",
Insert Into(NumericCols,Col << Get Name);
);
);
Tabulate(
Set Format( Uniform Format( 10, 2 ) ),
Add Table(
Column Table( Statistics( N ) ),
Column Table( Statistics( Mean ) ),
Column Table( Statistics( Std Dev ) ),
Column Table( Statistics( Min ) ),
Column Table( Statistics( Max ) ),
Column Table( Statistics( Median ) ),
Row Table(
Analysis Columns(
NumericCols = {}
)
)
)
)Re: 將表格中的所有數字列製成表格附言。
我重寫了這段代碼以處理連續列而不是數字。 這更適合我的需要,因為我有幾列實際上是名義上的,但有數字數據和值標籤。
這是我使用的最終代碼。
Names Default To Here( 1 );
dt = currentdatatable();
continuousCols /*NumericCols */ = dt << get column names( continuous /*numeric*/ );
dt << Tabulate(
Set Format( Uniform Format( 10, 2 ) ),
Show Control Panel( 0 ),
Add Table(
Column Table( Statistics( N ) ),
Column Table( Statistics( Mean, Std Dev ) ),
Column Table( Statistics( Min, Max ) ),
Column Table( Statistics( Median ) ),
Row Table( Analysis Columns( Eval( continuousCols /*NumericCols */ ) ) )
)
);
非常感謝你的幫助!
Re: 將表格中的所有數字列製成表格這是一種做你想做的事情的方法
dt = Open( "$SAMPLE_DATA/semiconductor capability.jmp" );
CharacterCols = dt << get column names( nominal );
// Build a string variable that contains the required JSL
theExpr =
"dt << Tabulate(
Show Control Panel( 0 ),
Add Table(
Column Table( Statistics( N, Name( \!"% of Total\!" ) ) ),";
For( i = 1, i <= N Items( CharacterCols ), i++,
theExpr = theExpr ||
"Row Table( Grouping Columns( " || char(CharacterCols[i]) || ") ),";
);
theExpr = theExpr || "));";
// Execute the JSL
eval(parse(theExpr));
其他社區成員可能有更好的方法
Re: 將表格中的所有數字列製成表格再次感謝您的配合。 您發送的第二個代碼仍然沒有給出我需要的結果。
請在下面查看我試圖獲得的結果,這是我在上一篇文章中發布的代碼的結果,然後是我從您的代碼中獲得的結果。
這就是我想要得到的:

這是我使用發布的代碼得到的:

TIA
Re: 將表格中的所有數字列製成表格問題不在於製表代碼。我為您提供的 Tabulate 代碼可以正常工作。問題在於表格中列的設置。在我發給你的最後一段代碼中,聲明
CharacterCols = dt << get column names( character );
將數據表中數據類型為字符的所有列放入 CharacterCols 列表。Tabulate 在 Lot_id 列、Lot ID 中的晶圓 ID 列中正確運行。這些是數據表中僅有的 2 列字符數據類型。我的誤解是您對分類變量的請求被包含在第二個製表中,意思是字符列。但是根據您的更正,分類需要在 Tabulate 中包括 Wafer 和 Site,需要以不同方式生成 CharacterCols 列列表。將涵蓋您想要的所有列的內容是加載該列表,其中包含建模類型為“名義”的所有列。因此,將語句簡單更改為
CharacterCols = dt << get column names( nominal );
將放入 CharacterCols 列表中, {lot_id, wafer, Wafer ID in lot ID, SITE};
修改後的 JSL 如下
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/semiconductor capability.jmp" );
CharacterCols = dt << get column names( nominal );
dt << Tabulate(
Set Format( Name( "% of Total" )(9, 0) ),
Show Control Panel( 0 ),
Add Table(
Column Table( Statistics( N, Name( "% of Total" ) ) ),
Row Table( Grouping Columns( eval( CharacterCols ) ) )
)
);
Re: 將表格中的所有數字列製成表格感謝您的回复,但是您發布的代碼沒有提供我需要的表格。
這是您使用的數據文件 examole 的代碼,它將為我提供所需的表格。
您會注意到輸出是不同的。
Tabulate(
Add Table(
Column Table( Statistics( N, Name( "% of Total" ) ) ),
Row Table( Grouping Columns( :lot_id ) ),
Row Table( Grouping Columns( :wafer ) ),
Row Table( Grouping Columns( :Wafer ID in lot ID ) ),
Row Table( Grouping Columns( :SITE ) )
)
);
我假設存在差異的原因是因為這裡每個行表都是單獨說明的,但是對於數字數據,它們都在同一個目錄下
"行表(分析列("
然後是用逗號分隔的列名列表。
這讓我想到對於數字我可以使用一個簡單的列表而不是字符。
感謝您的參考Scripting Guide 我絕對應該抽時間研究一下!
Re: 將表格中的所有數字列製成表格製表語法是不是完全不同,實際上除了“分析列”改為“分組列”外,它是相同的。
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/semiconductor capability.jmp" );
CharacterCols = dt << get column names( Character );
dt << Tabulate(
Set Format( Name( "% of Total" )(9, 0) ),
Show Control Panel( 0 ),
Add Table(
Column Table( Statistics( N, Name( "% of Total" ) ) ),
Row Table( Grouping Columns( eval( CharacterCols ) ) )
)
);
我想知道,是什麼讓您認為語法截然不同?我假設您正在以交互方式運行分析列的示例製表,然後讓 JMP 為您提供運行示例的 JSL,然後對字符列重複相同的操作。那會向您展示幾乎相同的 JSL。我想幫助您弄清楚是什麼讓您得出結論,這樣我就可以幫助您盡可能輕鬆地創建腳本。
哦....你需要閱讀腳本指南.....閱讀它是無可替代的。
幫助==>JMP 文檔庫…………..腳本指南
Re: 將表格中的所有數字列製成表格你好,
多謝!
我現在看到分類列的語法完全不同。
如果你想要一個包含以下內容的表格,你會怎麼做:
Set Format( Name( "% of Total" )(9, 0) ),
Add Table(
Column Table( Statistics( N, Name( "% of Total" ) ) ),
Re: 將表格中的所有數字列製成表格這是對您的代碼的重寫,它使用更簡單的方法來獲取數字列名稱,然後在數字列列表周圍添加 Eval() 函數,以使其工作
.
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/semiconductor capability.jmp" );
NumericCols = dt << get column names( numeric );
dt << Tabulate(
Set Format( Uniform Format( 10, 2 ) ),
Show Control Panel( 0 ),
Add Table(
Column Table( Statistics( N ) ),
Column Table( Statistics( Mean, Std Dev ) ),
Column Table( Statistics( Min, Max ) ),
Column Table( Statistics( Median ) ),
Row Table( Analysis Columns( Eval( Numericcols ) ) )
)
);
回覆:將表中的所有數字欄位製成表格我錯誤地編輯了上述問題並將問題更改為我的答案。 @eliyahu100我為我的錯誤道歉。