question on recipe()

Hello,
I have a small problem with recipe(). I construct a new variable (like old_variable^2 etc.) in dataset2 from old existing variables in dataset1.

rec <- recipe(Y ~ X1new + X2 + X3,
data = dataset2

model <- linear_reg() |>
set_engine('lm') |>
set_mode('regression')

R produces a weird error message:
Error in recipes::prep():! Not all variables in the recipe are present in the supplied training set: X1new. Run rlang::last_trace() to see where the error occurred.

=>I checked the X1new exists and has no errors or NAs. What happened?
Of course with other variables it works
Thank you.

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.