ames_train_x <- model.matrix(Value ~ ., train)[, -1]
ames_train_y <- log(train$Value)
ames_test_x <- model.matrix(Value ~ ., test)[, -1]
ames_test_y <- log(test$Value)
# Applying LASSO REGRESSION to data
ames_lasso <- glmnet(
x = ames_train_x,
y = ames_train_y,
alpha = 1
)
I get the following error: Error in glmnet(x = ames_train_x, y = ames_train_y, alpha = 1) : number of observations in y (3528) not equal to the number of rows of x (3527)
What am I doing wrong?
Thanks in advance