从列名的选择中,如何修改生成的列名列表你好呀,
也许你可以帮我弄清楚我在这里做错了什么。
我有以下玩具数据表:

我在改进由以下脚本生成的字符列名称列表时遇到了一些麻烦。
//get unique column names
cols = Current Data Table() << getColumnNames(Character);
//del columns I don't want
DELCOLS = {"Column 5", "Column 6"};
unique_col_names = Associative Array(cols) << Remove(Associative Array(DELCOLS)) << get keys;
//make a pop-up window
nw = New Window( "Set a Value",
<<MODAL></MODAL>
我得到的是结果模态弹出窗口中的以下内容。

我希望以下弹出窗口仅包含以下内容:

我认为我的问题可能与我对关联数组的知识差距有关,即使 JMP 脚本指南对关联数组键以及 remove from、remove、loc 和 contains 函数的说明,我也无法完全理解它有道理。
我想确保我在模型窗口中使用的结果列表中保留的列可以由用户在原始数据集中重命名,因此我要删除的列名将保持不变。 此外,数据表中列的排列方式相同,但关联数组按升序重新排列值。
根据这些论坛,我已经使用了以下方法,并且必须有一些我在这里没有看到的东西,因为我是 JSL 语言的新手。
- 从列表中删除元素
https://community.jmp.com/t5/Discussions/remove-elements-in-a-list/td-p/50865
- 从列号中获取列名并将我选择的列输入到要使用的列表中。
https://community.jmp.com/t5/Discussions/How-to-get-column-number-from-column-name-JMP/mp/5988
我附上了玩具数据集文件,其中包含我在上面引用的脚本。
数据表其他回复:从选择的列名中,如何修改生成的列名列表这是我解决这个问题的方法
Names Default To Here( 1 );
//get unique column names
cols = Current Data Table() << getColumnNames( Character, string );
//del columns I don't want
DELCOLS = {"Column 5", "Column 6"};
For( i = 1, i <= N Items( DELCOLS ), i++,
Try( Remove From( cols, Contains( cols, DELCOLS[i] ) ) )
);
unique_col_names = cols;
//make a pop-up window
nw = New Window( "Set a Value",
<<MODAL></MODAL>