[R] vector manipulations

2008-03-04 Thread Pete Dorothy
Hello, I have simulated a set of data which i called "nir" (a vector). I have created a function "logl" which calculates the log-likelihood. logl is a function of 2 real parameters : "beta" and "zeta" (of length 1). This function works perfectly well when I try for example "logl(0.1,0.2)" Now

Re: [R] vector manipulations

2008-03-04 Thread Erik Iverson
Did you read the help page for 'outer'? ?outer It says 'FUN' is called with these two extended vectors as arguments. Therefore, it must be a vectorized function (or the name of one), expecting at least two arguments. I don't think your logl function is vectorized according to

Re: [R] vector manipulations

2008-03-04 Thread Pete Dorothy
Thank you very much to both of you, and especially you Phil. I will tell you if it works. 2008/3/4, Phil Spector <[EMAIL PROTECTED]>: > > Pete - > As others have told you, outer only works with vectorized > functions. An alternative is to use expand.grid to find all > the combinations of bet

Re: [R] vector manipulations

2008-03-04 Thread Bill.Venables
700 mailto:[EMAIL PROTECTED] http://www.cmis.csiro.au/bill.venables/ -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Pete Dorothy Sent: Wednesday, 5 March 2008 3:38 AM To: r-help@r-project.org Subject: [R] vector manipulations Hello, I have simulated a set of

Re: [R] vector manipulations

2008-03-04 Thread Duncan Murdoch
On 3/4/2008 5:41 PM, [EMAIL PROTECTED] wrote: > Your problem is that your function log1( , ) is not vectorized with > respect to its arguments. For a function to work in outer(...) it must > accept vectors for its first two arguments and it must produce a > parallel vector of responses. > > To

Re: [R] vector manipulations

2008-03-04 Thread Bill.Venables
://www.cmis.csiro.au/bill.venables/ -Original Message- From: Duncan Murdoch [mailto:[EMAIL PROTECTED] Sent: Wednesday, 5 March 2008 9:36 AM To: Venables, Bill (CMIS, Cleveland) Cc: r-help@r-project.org Subject: Re: [R] vector manipulations On 3/4/2008 5:41 PM, [EMAIL PROTECTED] wrote: > Your problem

Re: [R] vector manipulations

2008-03-05 Thread Pete Dorothy
ro.au/bill.venables/ > > -Original Message- > > From: Duncan Murdoch [mailto:[EMAIL PROTECTED] > Sent: Wednesday, 5 March 2008 9:36 AM > To: Venables, Bill (CMIS, Cleveland) > Cc: r-help@r-project.org > Subject: Re: [R] vector manipulations > > On 3/4/2008 5:41 PM,