I´m running the stabsel
function on a dataset and I´m keep getting an error that I cannot overcome.
The command and error message are:
stab.lasso <- stabsel(x = table[, -2], y = table[, 2], fitfun = lars.lasso, cutoff = 0.75, PFER = 1) #column 2 has the outcome variable
Error in stabsel.matrix(x, y, ...) : ‘x’ and ‘y’ must have the same number of observations
However, as you can see below, the dimensions of the data frame (x) and outcome variable (y) are the same.
dim(table)
[1] 63 1142
lenght(table[, 2])
[1] 63
The outcome variable is dichotomous (0 or 1). I set it as integer and numeric, but I get the same error with both. In addition, I used the dataset as a matrix after selecting all numeric variables only.
I also compared the class of x and y with the example in the vignettes and they are the same class (https://cran.r-project.org/web/packages/stabs/vignettes/Using_stabs.html). Therefore I discarded a problem with how the data was entered.
I´m really confused why I´m getting the error and I cannot solve it.
Can anyone suggest me what to do/change?
Thanks a lot!!