How to execute the code for all rows of input

here im giving an excel sheet to R snipet I want execute this code for each row of input (sentence column) where my x should contain the sentence of that row
R knime.knwf (3.7 KB)

Hi @shivanisrivarshini -

A KNIME table passed into an R Snippet node can be referenced using So if you have a column in your R dataframe named X, then you could reference it within the snippet using$X. Since R operates vector-wise it will use each value of X.

(I wasn’t able to fully execute and test your workfow since I don’t have the source data, but after looking at it, I believe this should work.)

I wish to have specific rows only based on my operation and i’m passing this$col all values to a function for some operation and in that function i need specific rows to extract

If you want to use specific rows, you can use square brackets to focus on the rows you want. For example,$X[2:4] will grab only rows 2 through 4 of our example vector. This syntax applies in multiple dimensions too.

More info here:

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