-1

I am currently running an example in the glmnet documentation (https://cran.r-project.org/web/packages/glmnet/glmnet.pdf page 3):

> x=matrix(rnorm(100*20),100,20)
> y=rnorm(100)
> fit1=glmnet(x,y)
> plot(fit1,xvar="lambda")

However, I get this error message

Error in as.vector((beta %*% ones) > 0) : no method for coercing this S4 class to a vector

and I need help to understand why the error occurs.

John McClain
  • 51
  • 1
  • 2

1 Answers1

0

I run exactly the code you put and it works. Maybe you should remove your workspace and run again the code.

R18
  • 1,476
  • 1
  • 8
  • 17
  • thanks for the answer, I have removed my workspace, re-installed R, but without success. – John McClain Feb 20 '17 at 11:03
  • I think the problem should appear after runing the third line. Isn't it? Could you write the result of running `class(x)`and `class(y)` after running the two first lines? – R18 Feb 20 '17 at 11:47
  • The problem is solved! My version of R (2.13) does not like `glmnet`. Thanks – John McClain Feb 20 '17 at 12:57