Hi, I am using the R snippet node to take a column of strings, split them into their component letters, then output the results as a dataframe.
The code I have places is:
tmp ← knime.in # a simple table consisting of 1 column (“Column Header) of 16 strings #
df1 ← as.data.frame(tmp)
df1$‘splt’ ← c(strsplit(df1$Column Header
,split=”")) #adding the split strings as a second column in the df #
knime.out ← df1
This seems to work in R studio, which gives me the output:
df1
Column Header splt
1 Int_WC2hA1 I, n, t, _, W, C, 2, h, A, 1
2 Int_WC2hA2 I, n, t, _, W, C, 2, h, A, 2
3 Int_WC2hA3 I, n, t, _, W, C, 2, h, A, 3
4 Int_WC2hA4 I, n, t, _, W, C, 2, h, A, 4
5 Int_WD2hA1 I, n, t, _, W, D, 2, h, A, 1
6 Int_WD2hA2 I, n, t, _, W, D, 2, h, A, 2
7 Int_WD2hA3 I, n, t, _, W, D, 2, h, A, 3
8 Int_WD2hA4 I, n, t, _, W, D, 2, h, A, 4
9 Int_WC2hT1 I, n, t, _, W, C, 2, h, T, 1
10 Int_WC2hT2 I, n, t, _, W, C, 2, h, T, 2
11 Int_WC2hT3 I, n, t, _, W, C, 2, h, T, 3
12 Int_WC2hT4 I, n, t, _, W, C, 2, h, T, 4
13 Int_WD2hT1 I, n, t, _, W, D, 2, h, T, 1
14 Int_WD2hT2 I, n, t, _, W, D, 2, h, T, 2
15 Int_WD2hT3 I, n, t, _, W, D, 2, h, T, 3
16 Int_WD2hT4 I, n, t, _, W, D, 2, h, T, 4
However, the R snippet node fails when I run it.
Perhaps I am missing something basic, but does anyone have any ideas of why the node fails?