[R] error in Elastic net

Steve Lianoglou mailinglist.honeypot at gmail.com
Tue Aug 4 19:17:22 CEST 2009


Hi,

On Aug 4, 2009, at 1:03 PM, ram basnet wrote:

> Dear R users,
>
> I am new user for elastic net. I am trying to use elasticnet library.
> I have marker data with 359 markers and 168 samples, and response is  
> metabolites. I am trying to do regression between a metabolite and  
> markers.
>  But i am getting the following error:
>
>> en<- 
>> enet 
>> (marker,as.numeric(vio),lambda=0.5,normalize=FALSE,intercept=TRUE)
> Error in one %*% x : requires numeric matrix/vector arguments
>
> Then, I convert marker into numeric by using the following command.  
> And, here also getting error.
>
>> as.numeric(marker)
> Error: (list) object cannot be coerced to type 'double'
>> is.numeric(marker)
> [1] FALSE
>
>
> Alternatively, I converted marker into numeric by using data.frame  
> command, it seems markers are now converted into numeric.
>
>> is.factor(datafram01[,1])
> [1] FALSE
>> is.numeric(datafram01[,1])
> [1] TRUE
>
> But when i did again elastic net, i got the same error:
>
>> en<- 
>> enet 
>> (datafram01 
>> ,as.numeric(vio),lambda=0.5,normalize=FALSE,intercept=TRUE)
> Error in one %*% x : requires numeric matrix/vector arguments
>
> Does someone have ideas to overcome these problem?
>
> If it is, it will be great help for me.

My guess is that your "marker" variable needs to be a matrix, not a  
list, and not a data.frame.

The rows of the matrix will correspond to the individual observations  
and the columns are the features/predictors of each observation -- so  
in your case, it will be a matrix with 168 rows and 359 columns.

Try that and see if it works.

-steve

--
Steve Lianoglou
Graduate Student: Computational Systems Biology
   |  Memorial Sloan-Kettering Cancer Center
   |  Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact




More information about the R-help mailing list