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

[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 if I try

Re: [R] vector manipulations

2008-03-04 Thread Pete Dorothy
UC Berkeley [EMAIL PROTECTED] On Tue, 4 Mar 2008, Pete Dorothy wrote: 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

[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