Re: [R] vector manipulations

2008-03-05 Thread Pete Dorothy
Thank you everybody. Phil, your expand.grid works very nicely and I will use it for non-vectorized functions. Yet I am a bit confused about "vectorization". For me it is synonymous of "no loop". :-( I wrote a toy example (with a function which is not my log-likelihood). FIRST PART nir=1:10 log

Re: [R] vector manipulations

2008-03-04 Thread Pete Dorothy
Department of Statistics > UC Berkeley > [EMAIL PROTECTED] > > > > > On Tue, 4 Mar 2008, Pete Dorothy wrote: > > > Hello, > > > > I have simulated a set o

[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

[R] discrete variable

2008-03-02 Thread Pete Dorothy
Hello, I am sorry for asking such a basic question. I could not find an answer to it using google. I have a discrete variable (a vector x) taking for example the following values : 0, 3, 4, 3, 15, 5, 6, 5 Is it possible to know how many different values (modalities) it takes ? Here it takes 6 di