R should return 2 columns

Hi again,

i like to calculate the frequency of distinct integer values in a table. Therefore I am using a "R-Sniplet" Node with the following command:


the return is only the frequency of every value in val1, but not the corresponding value. I would like to have an Table like this:

value frequency
1 2
2 3
3 1

where val1 is maybe:

any idea how to manage this? :roll:


Frank Theisohn

Currently the R Snippet node only supports lists, arrays, vectors, and single elements of type double, int, and string - in one of our future releases, we will also support matrices. It's pretty high on my todo.

Anyway, to overcome this problem, you can use two R Snippet nodes, one outputs the attribute values and the other the frequencies, that is,
The Joiner node can then aggregate the two R results into one table. Make sure you handle duplicate column names within the Joiner node's dialog. Finally it should look similar to this screenshot:

Note, both R nodes need to be executed one after the other, since the variable R is used within both nodes as result value.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.