0

我有一个充满 ID 号的宽表(以可变数量的零开头),我想将其导入 KNIME,但这些列会自动检测为整数。我尝试手动修改与settings.xml导入节点对应的文件,以强制执行字符串类型导入,而无需花费我的下午时间来单击每一列,每次我得到一个新文件时。现在的条目是:

<entry key="cell_class" type="xstring" value="org.knime.core.data.def.StringCell"/>

重新打开工作流程时出现错误。所以我也将MissValuePattern条目修改为:

<entry key="MissValuePattern" type="xstring" value="?"/>

重新打开工作流时仍然出现错误。我看不出字符串和整数列之间有什么区别,所以我有点卡住了。

4

5 回答 5

1

Use the Line Reader Node to read each line in one at a time into one column. Then attach it to a Cell Splitter node and use the a space character (or whatever it is) that is separating the columns. Select the "as new columns" radio button and the new columns will have the same type as the original column, i.e., a String.

于 2014-05-22T10:19:43.847 回答
1

You can manually execute arbitrary java code to create a new column or to replace an existing one using Java Snippet (simple) or Java Snippen. For example, you can concatenate your number of values of the Integer columns Col0, Col1, Col2 as

String myCol = $Col0$ + " " + $Col1$ + " " + $Col2$;
return myCol; 
//or return $Col0$ + " " + $Col1$ + " " + $Col2$;

In general it is relly useful method for creating new parameters of a dataset.

于 2015-06-30T11:45:48.830 回答
0

如果您使用Line Reader并根据您喜欢的分隔符拆分列,它可能会更好。

于 2014-05-19T13:06:06.893 回答
0

使用数字到字符串节点。您可以单击“始终包含所有列”,每次导入新文件时它都会自动选择所有列。

于 2014-05-19T11:10:39.830 回答
0

您可以在文件阅读器节点的对话框中为每列指定列类型。因此打开对话框并双击要更改的列的标题。将打开一个小窗口,您可以在其中指定列的类型。将其从整数更改为字符串。

于 2014-08-05T16:12:01.853 回答