Re: [R] invalid arguments RUNIF

From: Peter Dalgaard <>
Date: Tue, 17 Jun 2008 15:10:19 +0200

Erik Iverson wrote:
> Just a general comment, I have not looked at your code. You may want
> to look at the Debugging R portion of the Introduction to R manual on
> CRAN. There is also a graphical debugger from the 'debug' package on
> CRAN. Either one of these will become immensely helpful in situations
> like this.
Also, in this particular case, the offending call is in your own code, so how about print()ing the arguments to runif() before running it?

> Yasin Hajizadeh wrote:
>> Hi all
>> I would be grateful you can help me with my problem.
>> I try to run an optimization code . in one line I have runif in
>> order to sample the PDF. I get this error while i run it. Error
>> in runif(1, f$d[[n.of.u.vars + n.of.o.vars + j]][[2]][1],
>> f$d[[n.of.u.vars + : invalid arguments
I.e, insert


at the beginning of the for loop below

>> for (j in 1:n.of.x.vars) {
>> X <- c(X, runif(1,f$d[[n.of.u.vars+n.of.o.vars+j]][[2]][1],
>> f$d[[n.of.u.vars+n.of.o.vars+j]][[2]][2]))
>> }
>> X <- t(X)
(You likely don't really want to grow X on every call to runif(), but that is a different matter)

   O__  ---- Peter Dalgaard             Ă˜ster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark      Ph:  (+45) 35327918
~~~~~~~~~~ - (              FAX: (+45) 35327907

______________________________________________ mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.
Received on Tue 17 Jun 2008 - 13:39:32 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 17 Jun 2008 - 14:30:47 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive