具有多個日期列和數據列的自動化控製圖你好,
我正在嘗試自動化一種從如下格式的表格構建控製圖的方法,
| 引擎 | 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 的參數數量不相等,因此表格在這種情況下並不統一,這也使這變得更加困難。
謝謝!
回复:具有多個日期列和數據列的自動化控製圖這意味著您嘗試插入的項目不是列表。在這段代碼中:
a=3;
insert into(c,a)
你會得到錯誤,因為變量“c”沒有被定義為一個列表。
回复:具有多個日期列和數據列的自動化控製圖嘿吉姆,我認為這真的很接近我的需要。 我收到一個錯誤,即:
在訪問或評估“插入”時只能插入 L 值
你能解釋一下這意味著什麼嗎?
謝謝
回复:具有多個日期列和數據列的自動化控製圖吉姆,在我完成我的解決方案之前發布......再次。我的方法大致相同,但我喜歡使用創建的函數來處理列表,從而減少大量代碼。我稱為 Lfunc(list, expr) 的函數對列表中的每個項目運行表達式。[這是很久以來的 JMP 願望清單項目]。
因此,對於您提供的示例,下面 JSL 中的第 3 行返回 [2, 7 ,10]。 對於這些列中的每一列,我得到代碼,以“params =”開頭的行返回以該代碼開頭的所有列(不包含日期)。
除了另一種方法並再次希望使用 Lfunc() 之類的 JMP 內置函數之外,我注意到您正在創建非活動控製圖,也許這就是您的目標。如果您想要“實時”交互式圖表,對於突出顯示和懸停幫助,請參閱附件 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")) )));
回复:具有多個日期列和數據列的自動化控製圖我相信我理解你的問題。 我採用了這種方法來查找數據中的所有組,並在每個列表中創建一個單獨的列列表。然後,這些組在它們之間循環,並且該列表中的每一列都被處理我沒有數據表來測試我的解決方案,所以我相信代碼應該用作如何解決問題,但不應被視為最終解決方案
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;
);
);