回复:JMP 16:使用相对引用使用公式添加列的脚本谢谢马克! 工作起来很有魅力!
做了一些调整,把它留在这里以备将来参考。 多谢!
Names Default to Here( 1 );
// mock up user data table
dt = New Table( "Mock Up" );
For( c = 1, c < 6, c++,
col = dt << New Column( "My Column " || Char( c ), Numeric, Continuous );
col << Set Values( J( 25, 1, Random Normal( 80, 5 ) ) );
);
y = dt << Get As Matrix;
col = dt << New Column( "Total", Numeric, Continuous );
col << Set Values( y * J( 5, 1, 1 ) );
// solution
dt = Current Data Table();
total = Column( N Col( dt ) ) << Get As Matrix;
last c = N Col( dt );
For( c = 1, c < last c, c++,
dt << New Column( "Relative " || (Column( c ) << Get Name), Numeric, Continuous,
Formula( :As Column( c ) /:Total )
);
);
回复:JMP 16:使用相对引用使用公式添加列的脚本看这个例子:
Names Default to Here( 1 );
// mock up user data table
dt = New Table( "Mock Up" );
For( c = 1, c < 6, c++,
col = dt << New Column( "My Column " || Char( c ), Numeric, Continuous );
col << Set Values( J( 25, 1, Random Normal( 80, 5 ) ) );
);
y = dt << Get As Matrix;
col = dt << New Column( "Total", Numeric, Continuous );
col << Set Values( y * J( 5, 1, 1 ) );
// solution
dt = Current Data Table();
total = Column( N Col( dt ) ) << Get As Matrix;
last c = N Col( dt );
For( c = 1, c < last c, c++,
dt << New Column( "Relative " || (Column( c ) << Get Name), Numeric, Continuous,
Values( (Column( c ) << Get Values) :\</img> total )
);
);
JMP 16:使用相对引用添加带有公式的列的脚本你好,
尝试在 JMP 中编写我的第一个脚本,非常感谢您的帮助。
我有 10 列(比如说一、二、三、四、五、六、七、八、九、十)和一个总计列。
我需要再添加十列来计算前十列的百分比。 我不能使用列名,因为我实际上有 150 列,并且列名都不同。
我如何添加一个新列并每次将公式中的列前进 1
例如 :
创建新列第 11 列
填写公式“第 1 列 / 总计”
将列名称设置为“pct_one”
创建新列第 12 列
填写公式“第 2 列 / 总计”
将列名称设置为“pct_two”
。
。
。
继续 10 列。
提前致谢!
消费者和市场研究质量和工艺工程视窗