事實上,我來到社區是為了看看是否已經有一些新的東西,仍然不確定我是否缺少現在內建的東西...
我想使用 JSL 將某些值(例如 -999 或 >998)替換為許多列(可能是所有數字列)中缺少的值。 編寫這個腳本並不難。很好的例子說明了我的意思以及我目前在這裡所做的事情:
https://community.jmp.com/t5/Discussions/Deleting-cell-values/td-p/46957
但是(1)這似乎是相當常見的東西,因此可能值得它自己的內建函數(或編寫重新編碼能力的腳本的能力),並且(2)它在大數據上的速度不是閃電般的快,所以如果可能的話,也許有更多的資源有效的底層方法可能是此類解決方案的一部分。(?)
如果速度更快,資料表下標也是一種選擇:
dt = open("$SAMPLE_DATA/Big Class.jmp");
r = loc(dt[0, 4]==61)
dt[r, 4] = .;不久前請求的願望清單項目是將列屬性指派給定義的表組列(列清單)。
一種非常簡單的替代方法是選擇需要「清理」的列。 將缺失值代碼屬性複製到剪貼簿,然後傳送 JSL 訊息貼上多列屬性到數據表。 附加的腳本顯示了一種無需 for 循環即可替換值的矩陣方法,但是,我發現缺失值程式碼更有用:資料庫(原始)資料值不會被修改,可以設定多個值,並且可以設定原始值被恢復。
Names Default to Here(1);
//create example table
dt = New Table( "example",
Add Rows( 3 ),
New Column( "A",
Character,
"Nominal",
Set Values( {"", "", ""} )
),
New Column( "B",
Character,
"Nominal",
Set Values( {"", "", ""} )
),
New Column( "C",
Character,
"Nominal",
Set Values( {"", "", ""} )
),
New Column( "x_1",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [1, 2, 8] )
),
New Column( "x_2",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [8, 8, 8] )
),
New Column( "x_3",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [2, 8, 2] )
),
New Column( "x_4",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [7, 8, 5] )
),
New Column( "x_5",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [2, 8, 3] )
),
New Column( "x_6",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [2, 8, 8] )
),
New Column( "E",
Character,
"Nominal",
Set Values( {"", "", ""} )
)
);
// this replaces values
<STRONG>cnme = dt << get column names(numeric);
dt << select Columns(cnme);</STRONG>
mat = dt << get as matrix;
mat[loc(mat==8)]=empty();
dt[1::nrow(dt),cnme]=mat;
//Close dt and rerun the code to create dt
<STRONG>set clipboard("{Add Column Properties(Set Property(\!"Missing Value Codes\!", {8}))}");
dt << Paste Multi Columns Properties;</STRONG>
//The value of 8 appears, but is treated as missing.
//There is a request that column property settings can be assigned to a column group