Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201839

Error: number of observations in y not equal to the number of rows of x

$
0
0
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


Viewing all articles
Browse latest Browse all 201839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>