合并名称中包含特定子字符串的列你好,
我试图仅合并数据表“dtPatList”中名称中包含子字符串“INIT”的列,但是不起作用。
我知道该问题与下面我加粗的参数有关。有人可以建议正确的方法吗?
谢谢!!
// 获取 dt cols 名称
nc = ncols (dtPatList);
// 获取 dt cols 名称
col_list = dtPatList <<获取列名(字符串);
对于(i = nitems (col_list),i > 0 ,i--,
if (! contains (col_list[i], "INIT" )), /// 新的 ps 列
从 (col_list,i) 中删除;
)
(英文):
//合并初始列
dtPatList <<合并列(
分隔符( “_” ),
列(col_list),
选定的列是指示列( 0 ),
列名称( “INIT_Chain” )
(英文):
高级统计建模消费者和市场研究内容组织数据混合和清理实验设计大规模定制质量与工艺工程回复:合并名称中包含特定子字符串的列您需要在 col_list 周围放置一个 eval() 函数,以便在函数 Combine Columns 执行时对其进行扩展。
// get the dt cols names
dtPatlist = current data table();
nc = N Cols( dtPatList );
// get the dt cols names
col_list = dtPatList << get column names( string,character );
For( i = N Items( col_list ), i > 0, i--,
If( !Contains( col_list[i], "INIT" ), /// new ps columns
Remove From( col_list, i );
)
);
//Combine init cols
dtPatList << Combine Columns(
delimiter( "_" ),
Columns(eval(col_list)),
Selected Columns are Indicator Columns( 0 ),
Column Name( "INIT_Chain" )
);
回复:合并名称中包含特定子字符串的列尝试在 Columns 中添加 Eval():
Columns(Eval(col_list))