cv.glmnet Function

Dear All,

I'm a new user for R studio and I hope you can support me with this issue.
I would liket to us cv.glmnet function but first it always give me error message.
Here code that I wrote:
sample<-sample.split(LA10061,SplitRatio = 0.7)
test<-subset(LA10061, sample="FALSE")
y_train<-train[ ,1]
x_train<-train[ ,2:15]
y_test<-test[ ,1]
x_test<-test[ ,2:15]
y_train1<- as.matrix(y_train)<-cv.glmnet(x_train,y_train,type.measure="mse",alpha=0,family="gaussian")

First error message was:
Error in storage.mode(y) <- "double" :
'list' object cannot be coerced to type 'double'
after some research I realize i need to convert in matrix my data but then I get this error message:
Error in elnet(x, is.sparse, ix, jx, y, weights, offset, type.gaussian,
and I realize the solution is use function model.matrix but then I get this error message:
Error in [[<*tmp*, i, value = c(36L, 32L, 145L, 64L,

I'm a bit lost about how to solve this issue.

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