[R] What does this say? Error in rep("(Intercept)", nrow(a0)) : invalid 'times' argument

Bert Gunter gunter.berton at gene.com
Sun May 26 16:04:11 CEST 2013


Mike:

On Sat, May 25, 2013 at 7:24 PM, C W <tmrsg11 at gmail.com> wrote:
> Thomas, thanks for the cool trick.  I always thought browser() was the
> only thing existed, apparently not.

Which you would have known had you read the docs!

See section 9 on Debugging in the R Language Definition Manual

-- Bert

>
> Mike
>
> On Sat, May 25, 2013 at 9:09 PM, Thomas Stewart
> <tgs.public.mail at gmail.com> wrote:
>> Mike-
>>
>> You can use the traceback function to see where the error is:
>>
>>>  bob <- matrix(rnorm(100*180), nrow=180)
>>>  yyy <- rnorm(180)
>>>  fit1 <- cv.glmnet(bob, yyy, family="mgaussian")
>> Error in rep("(Intercept)", nrow(a0)) : invalid 'times' argument
>>>  traceback()
>> 6: predict.multnet(object, newx, s, type, exact, offset, ...)
>> 5: predict.mrelnet(glmnet.object, type = "nonzero")
>> 4: predict(glmnet.object, type = "nonzero")
>> 3: lapply(X = X, FUN = FUN, ...)
>> 2: sapply(predict(glmnet.object, type = "nonzero"), length)
>> 1: cv.glmnet(bob, yyy, family = "mgaussian")
>>
>> So, thee error is in the predict.multnet function.  If you peak at that
>> function, you see where the function falls apart.  It seems that the
>> function wants a0 to be a matrix but in this example it is a vector.  I'm
>> not familiar enough with the package to offer advice on how to fix this.
>>
>> -tgs
>>
>>
>>
>> On Sat, May 25, 2013 at 4:14 PM, C W <tmrsg11 at gmail.com> wrote:
>>>
>>> Dear list,
>>> I am using glmnet.  I have no idea what this error is telling me.
>>> Here's my code,
>>>
>>> > bob <- matrix(rnorm(100*180), nrow=180)
>>> > yyy <- rnorm(180)
>>> > fit1 <- cv.glmnet(bob, yyy, family="mgaussian")
>>> Error in rep("(Intercept)", nrow(a0)) : invalid 'times' argument
>>>
>>> In fact, I peeked inside cv.glmnet() using,
>>> > glmnet:cv.glmnet
>>>
>>> Can't even find the error message in the code.  I am clueless at the
>>> moment.
>>> Thanks in advance,
>>> Mike
>>>
>>> ______________________________________________
>>> R-help at r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide
>>> http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>>>
>>
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm



More information about the R-help mailing list