Re: [R] strange behavior of my function

2008-04-01 Thread Bill.Venables
7700 mailto:[EMAIL PROTECTED] http://www.cmis.csiro.au/bill.venables/ -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of ronggui Sent: Wednesday, 2 April 2008 2:03 AM To: Kyeongmi Cheon Cc: R help mailing list Subject: Re: [R] strange behavior of my function

Re: [R] strange behavior of my function

2008-04-01 Thread ronggui
You should write the function in this way, I think. convert.to.trinom3=function(data, z1, z2){ ans <- data ans[data=z2]=2 ans } On Tue, Apr 1, 2008 at 11:54 PM, Kyeongmi Cheon <[EMAIL PROTECTED]> wrote: > Hello, > I wrote a program to convert normal distribution to trinomial > distrib

[R] strange behavior of my function

2008-04-01 Thread Kyeongmi Cheon
Hello, I wrote a program to convert normal distribution to trinomial distribution (three levels=0,1,2). But the first function I wrote (convert.to.trinom1) converts everything to 2. When I changed it slightly (convert.to.trinom2), it works correctly (ie. converts to 0,1, or 2). I cannot figure out