我有一个原始数据需要将文本转换为包含许多特殊字符的列,然后将它们堆叠起来。您能否帮助通过 JSL 脚本为一般情况提供解决方案。请帮助参考我的 excel 文件以了解详细信息
以下脚本将获取原始数据表并拆分出目标列,然后堆叠结果。鉴于一些拆分出的列仅由字符串数据组成,而一些列似乎是数值,因此堆叠所有列似乎不是您想要的。
Names Default To Here( 1 );
dt = Current Data Table();
targetCol = "domain_frequency_core";
// Text to columns
Data Table( "Book1 (4)_Sheet1" ) <<
Text to Columns( columns( Column( targetCol ) ), Delimiters( "@" ) );
// Get list of all target columns except original column
stackList = Filter Each( {name}, dt << get column names( string ),
Contains( name, targetCol ) & name != targetCol
);
// Stack the new columns
dt << Stack(
columns( stackList ),
Source Label Column( "Label" ),
Stacked Data Column( "Data" ),
Output Table( "Final Stacked Data Table" )
);
请花时间研究该脚本。所有使用的功能和平台均记录在脚本索引和 JMP 帮助屏幕中。