Re: [R] (no subject)

From: Ben Fairbank <>
Date: Wed 12 Jul 2006 - 05:47:49 EST

Well, it's a little inelegant, but since the amount of information is the same in events that are certain to occur and certain not to occur, you could add the line

prob[prob==0] <- 1

after you set up the prob vector, which would take care of the problem.

Ben Fairbank

-----Original Message-----
[] On Behalf Of Taka Matzmoto Sent: Tuesday, July 11, 2006 2:26 PM
Subject: [R] (no subject)

Dear R-users

>prob <- c(0.5,0.4,0.3,0.1,0.0)
>cal <- prob * log(prob,base=2)
[1] -0.5000000 -0.5287712 -0.5210897 -0.3321928 NaN

Is there any way to change NaN to zero ?

Thank you

Taka mailing list PLEASE do read the posting guide! mailing list PLEASE do read the posting guide! Received on Wed Jul 12 05:56:34 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 12 Jul 2006 - 08:18:20 EST.

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