>prob <- c(0.5,0.4,0.3,0.1,0.0)
>cal <- prob * log(prob,base=2)
 -0.5000000 -0.5287712 -0.5210897 -0.3321928 NaN
Is there any way to change NaN to zero ?
Archive maintained by Robert King, hosted by
the discipline of
statistics at the
University of Newcastle,
Archive generated by hypermail 2.1.8, at Wed 12 Jul 2006 - 06:17:26 EST.
Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.