NLR regression with R Learner

Hi, I’m quite a new user of this platform.
I need to implement a “non linear regression” model in knime with R and I’m using using “R learner” node with the “nls” function. I don’t know whether it’s a matter of library that I need to upload or is a mistake on the scripting, but it keeps stopping beacause of a error.

This is the script I wrote inside the R Learner node:

install.packages(‘nlstools’)
library(nlstools)
data ← knime.in
exp <-function(knime.in$“months”, a, b) {a * exp(-b * knime.in$“months”)}
nlinR ← nls(knime.in$“Price” ~ exp(knime.in$“Age_in_months”, a, b), data=knime.in, start=list(a=80000,b=0.1))

And the error is the following:

ERROR R Learner 0:660 Execute failed: Error in R code:
Error: :6:20: unexpected ‘$’
5: data ← knime.in
6: exp <-function(data$
^

Can anyone help?
Thank you very much

@Brutus welcome to the KNIME forum.

Not having studied this in great detail but from want I remember some R packages do not like the dot in the “knime.in” file name. Maybe try with the data file table you created.

If this does not help maybe you could provide a minimal example that demonstrates the problem.

1 Like

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