用()代替每行()對每列錯誤越界我需要在整個資料表中搜尋和替換字串。我引用了這個解決方案,希望能得到一些優雅的東西,但它抱怨我的 10 行表中的第 11 行。
在 JMP Pro 16.1 上運行的程式碼
allCols = file << get column names(string);
file << group columns("col group", myCols);
myCols = file << get column group("col group");
for(cols = 1, cols <= n items(myCols), cols++,
file << begin data update;
for each row(file,
file:myCols[cols] = substitute(file:myCols[cols],
"X", "0"
)
);
file << end data update;
);錯誤:
Cannot set value for the column 'dot' because the row number (11) is not valid.
at row 1 in access or evaluation of 'Assign' , file:myCols[cols] = /*###*/Substitute( file:myCols[cols], "X", "0" ) /*###*/
忘記新增範例列:
64.0
47.0
2.0
106.0
174.0
12.0
X
2.0
X
14.0
進階統計建模消費者與市場研究資料存取大規模客製化品質和工藝工程回覆:對每行()對每列進行替換(),錯誤超出範圍對您的程式碼進行以下輕微修改似乎可以正常工作
Names Default To Here( 1 );
file = Current Data Table();
allCols = file << get column names( string );
file << group columns( "col group", allCols );
myCols = file << get column group( "col group" );
For( cols = 1, cols <= N Items( myCols ), cols++,
file << begin data update;
For Each Row(
file,
As Column( file, myCols[cols] ) = Substitute( As Column( file, myCols[cols] ),
"X", "0"
)
);
file << end data update;
);