如何把下列这几行代码在R语言里面用for循环的形式写出来yhat0 <- predict(fit0,
s=fit0$lambda.1se,
newx=x.test)yhat1 <- predict(fit1,
s=fit1$lambda.1se,
newx=x.test)yhat2 <- predict(fit2,
s=fit2$lambda.1se,
newx=x.test)yhat3 <- predict(fit3,
s=fit3$lambda.1se,
newx=x.test)yhat4 <- predict(fit4,
s=fit4$lambda.1se,
newx=x.test)yhat5 <- predict(fit5,
s=fit5$lambda.1se,
newx=x.test)yhat6 <- predict(fit6,
s=fit6$lambda.1se,
newx=x.test)yhat7 <- predict(fit7,
s=fit7$lambda.1se,
newx=x.test)yhat8 <- predict(fit8,
s=fit8$lambda.1se,
newx=x.test)yhat9 <- predict(fit9,
s=fit9$lambda.1se,
newx=x.test)yhat10 <- predict(fit10,
s=fit10$lambda.1se,
newx=x.test)我写的是这样,但是不怎么该怎么改进for(i in 0:10){
assign(paste("yhat",i,sep=""),predict(fiti,X.test,lambda =cv2[["lambda.min"]])
}
predict()里面的fiti 该怎么改比较好呀,直接这样写是肯定不行的