用点“缺失值”替换 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