Yes you can. Here an example of this code working with a lambda.min
set to 1:
library(glmnet)
x=matrix(rnorm(100*20),100,20)
y=rep(0:1,50)
lambda.min=1
Final_model<-glmnet(x,y, family="binomial",alpha = 1,lambda=lambda.min)
Final_model
Call: glmnet(x = x, y = y, family = "binomial", alpha = 1, lambda = lambda.min)
Df %Dev Lambda
[1,] 0 -1.121e-15 1
Update
If you have warning messages during the exacution, this could be related to the use of a single lambda value, this is deprecated in the documentation ?glmnet
:
lambda: A user supplied lambda sequence. Typical usage is to have the
program compute its own lambda sequence based on nlambda and
lambda.min.ratio. Supplying a value of lambda overrides this. WARNING:
use with care. Avoid supplying a single value for lambda (for
predictions after CV use predict() instead). Supply instead a
decreasing sequence of lambda values. glmnet relies on its warms
starts for speed, and its often faster to fit a whole path than
compute a single fit.
Related questions here and here