使用多个日期列和数据列自动控制图表你好,
我试图自动化一种方法来构建如下格式的表格控制图表,
| 发动机 | 314-日期 | 314-参数1 | 314参数2 | 314-参数等。 | 213参数1 | 213-约会 | 241参数1 | 241参数2 | 241-日期 |
| # | 日期 | # | # | # | # | 日期 | # | # | 日期 |
| # | 日期 | # | # | # | # | 日期 | # | # | 日期 |
我有这个代码让我接近我想要的。
Rcols = dt << GetColumnNames( Continuous, String );
nw = New Window( "Control Charts", myVLB = V List Box() );
For( i = 1, i <= N Items( Rcols ), i++,
cc = Control Chart(
Sample Label( Column( dt, Rcols[1] ) ),
KSigma( 3 ),
Chart Col( Column( dt, Rcols[i] ), Levey Jennings )
);
myVLB << Append( Report( cc ) );
cc << close window;
);
但是,现在的问题是试图找到一种方法来使样本标签成为参数ID的正确日期。每个ID的参数数量不同,因此表格不一致,这也使得这一点变得更加困难。
谢谢!
Re:使用多个日期列和数据列自动控制图表这意味着您尝试插入的项目不是List。 在这段代码中:
a=3;
insert into(c,a)
你会得到错误,因为变量“c”没有被列为列表。
Re:使用多个日期列和数据列自动控制图表嘿吉姆,我认为这非常接近我所需要的。我收到的错误是:
在访问或评估“插入到”时只能插入L值
你可以对这意味着什么吗?
谢谢
Re:使用多个日期列和数据列自动控制图表吉姆,在我完成解决方案之前发布了...... 再次。 我的方法大致相同,但我喜欢使用创建的函数来处理列表,从而减少了大量代码。 我调用Lfunc(list,expr)的函数在列表中的每个项上运行表达式。 [这是很长时间的JMP愿望清单项目]。
因此,对于您提供的示例,下面的JSL中的第3行返回[2,7,10]。对于每个列,我得到代码,以“params =”开头的行返回以该代码开头的所有列(不包含日期)。
除了另一种方法,并再次希望JMP内置函数像Lfunc(),我注意到你正在创建非活动控制图表,也许这是你的目标。 如果您需要“实时”交互式图表,以突出显示和悬停帮助,请参阅附加文件FindColumns_CC.jsl中的注释代码
dt=current data table();
Rcols = dt << GetColumnNames(String ); //get all coumns so the code can use the column number
dateCols = Loc(Matrix(Lfunc(RCols, Expr(Contains(Lowercase(x),"date"))))); //2,7,10
nw = New Window( "Control Charts", myVLB = V List Box() );
for(i=1, i<=nrow(dateCols), i++,
code = Trim(word(1, Rcols[dateCols[i]], "-"));
params = Loc(Matrix(Lfunc(RCols, Expr(StartsWith(x,code) & !Contains(lowercase(x),"date")) )));
Re:使用多个日期列和数据列自动控制图表我相信我理解你的问题。我采用了这种方法,找到数据中的所有组,并创建每个列表中的列的单独列表。 然后,组遍历它们,并且处理该列表中的每个列我没有数据表来测试我的解决方案,所以我相信代码应该用作如何解决该问题的良好指南问题,但不应被视为一种解决方案
Rcols = dt << GetColumnNames( Continuous, String );
// Process the columns into group and separate lists for each group
groupList = {};
For( i = 2, i <= N Items( Rcols ), i++,
theGroup = Word( 1, Rcols[i], "-" );
// Check if the group has been seen before
If( Contains( groupList, theGroup ) > 0,
// If this is a new group, create a list to hold the column names
Eval( Parse( "Group_" || theGroup || " = {};" ) );
// Add the group name to the groupList
Insert Into( groupList, theGroup );
// Add the current parameter to the new group list
Insert Into( "Group_" || theGroup, Rcols[i] );
,
// If this isn't a new group list, then add it to the
// already existing group list
Insert Into( "Group_" || theGroup, Rcols[i] )
);
);
// Create the display window
nw = New Window( "Control Charts", myVLB = V List Box() );
// Loop across the groups
For( group = 1, group <= N Items( groupList ), group++,
// Set a standard list name to have the values of the current Group_list
Eval( Parse( "tempRcols = Group_" || groupList[group] || ";" ) );
// Generate the charts
For( i = 2, i <= N Items( tempRcols ), i++,
cc = Control Chart(
Sample Label( Column( dt, tempRcols[1] ) ),
KSigma( 3 ),
Chart Col( Column( dt, tempRcols[i] ), Levey Jennings )
);
myVLB << Append( Report( cc ) );
cc << close window;
);
);