cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
The Discovery Summit 2025 Call for Content is open! Submit an abstract today to present at our premier analytics conference.
See how to use JMP Live to centralize and share reports within groups. Webinar with Q&A April 4, 2pm ET.
Choose Language Hide Translation Bar
View Original Published Thread

如何通过变量列名进行汇总

MuttonChops
Level III

我有一个包含可变数字,连续列名的表。 我需要得到每列的平均值,按不同的列分组。 下面的脚本显示了我正在尝试做的事情,它创建了一个适用于此目的的通用表。 我被挂在“Mean(ColNames)”行上,因为它似乎无法处理。 

 

如果我更换 “平均数(ColNames)” 使用“Mean(:Col2,:Col3)”或“Mean(:Name(”Col2“),: Name(”Col3“))”然后它可以工作,但显然不符合我能够使用变量列的需要。 我是关闭还是离开?

 

 

// Make a table to work with
nr = 20;
nc = 3;
dt = NewTable("Random_Table");
For(c=1, c<=nc, c++,
  dt << NewColumn("Col"||Char(c), Numeric, Continuous, Formula(RandomInteger(1, 10)));
  );
dt << AddRows(nr);
Column(1) << Data Type(Character);

//Get column names for the numeric continuous columns
ColNames = dt << Get Column Names(Numeric, "Continuous");

dt << Summary(
  Group(:Col1),
  Mean(ColNames),
  statistics column name format( "column" )
);

 

This post originally written in English (US) has been computer translated for you. When you reply, it will also be translated back to English (US).

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re:如何通过变量列名来汇总

在列列表周围放置和Eval()它将起作用

names default to here(1);
dt=open("$SAMPLE_DATA\big class.jmp");

ColNames = dt << Get Column Names(Numeric, "Continuous");

dt << Summary(
  Group(:sex),
  Mean(eval(ColNames)),
  statistics column name format( "column" )
);
1 REPLY 1
txnelson
Super User

Re:如何通过变量列名来汇总

在列列表周围放置和Eval()它将起作用

names default to here(1);
dt=open("$SAMPLE_DATA\big class.jmp");

ColNames = dt << Get Column Names(Numeric, "Continuous");

dt << Summary(
  Group(:sex),
  Mean(eval(ColNames)),
  statistics column name format( "column" )
);

This post originally written in English (US) has been computer translated for you. When you reply, it will also be translated back to English (US).