I'm using the R snippet node present in the KNIME Labs – R (Interactive). As I'm new using flow variables, I need your help to do something that is easy in theory: use the value of a flow variable in the R snippet as a variable name.
I will explain it better. I have the following working R snippet code:
which builds a linear model using the variable “housecost” as response,and which is present in the knime.in data. Now I want to generalize it and I want to pass to the lm.fit model the response variable name (in this case “housecost”) using a flow variable called “response” which value is “housecost”.
I tried the following:
but it gave me the error:
Error in model.frame.default(formula = knime.flow.in[["response"]] ~ ., : variable lengths differ (found for 'X')
I also tried:
But it gave me a similar error.
I'm sure I'm missing something obvious, but I cannot understand from basic documentation. Please, can you help me to understand?