用點“缺失值”替換 0 值如何更改數據表以將設置為 0 的值轉換為點,我找到了將點更改為 0 的腳本,但不是替代方法。
謝謝,
數據表腳本編寫回复:用點“缺失值”替換 0 值我建議看看這個帖子您是否應該循環遍歷數據表或使用重新編碼,或使用獲取行位置來更改數據表中的值(和原來的郵政) 和那裡的討論。 如果我沒記錯的話,重點是用缺失值替換 999。 基本思想通常是遍歷行或列並替換值。
回复:用點“缺失值”替換 0 值對於名為“A”的列,這是將所有“0”轉換為缺失值的一種方法;
Names Default To Here( 1 );
dt = Current Data Table();
theRows = dt << get rows where( :A == 0 );
Try( :A[theRows] = . );
回复:用點“缺失值”替換 0 值如果你正在嘗試做整張桌子,你可以做
Names default to here( 1 );
dt = open("$SAMPLE_DATA\Big Class.jmp");
dt:weight[[1, 5, 6, 8]] = 0; // just setting them to 0
dt:height[[11, 15, 16, 18]] = 0;
wait(2);
// this is the bit you'll want
numeric_cols = dt << Get Column Names("Numeric", "string");
m = dt[0, numeric_cols]; // get the values as a matrix;
m[Loc(m==0)]=.; // set them to missing
dt[0, numeric_cols] = m; // set the data to the matrix