将表格中的所有数字列制表你好,
我正在尝试创建一个包含所有数字列(然后是另一个包含分类列)的制表表。
我尝试运行它,但它不起作用。
有什么建议吗?
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我对我的错误表示歉意。