你好
假设我们有一个数据集,我们希望在选定的列中获得最大值
dt = New Table( "Untitled",
New Column( "a@b;2", Numeric, Set Values( [12, 33, 1] ) ),
New Column( "b", Numeric, Set Values( [2, 11, 2] ) ),
New Column( "c@d;3", Numeric, Set Values( [333, 1, 0] ) )
);
colnames = dt << getcolumnnames;
use_cols = {};
include = {"@"};
For( j = 1, j <= N Items( include ), j++,
For( i = 1, i <= Nitems( colnames ), i++,
If(Contains(colnames[i], include[j]),
insert into (use_cols , colnames[i]))
));
dt << new column("max_col",numeric,formula(Maximum(use_cols)))
我不明白为什么它在max_col中返回缺少的值?我们应该遍历use_cols吗?
谢谢!