Peter, you're right about the error - I had R commander open and used the terminal instead - this makes me miss the error messages. Not that I would have known how to solve it had I seen it :)
And yes, ifelse does work. Not sure I understand what the difference is, but thanks! David, I had no idea god could change the laws of mathematics. If that's true then you have to choose between believing in on or the other? Nice one! Of course Ben is right, the convention is 0*log(0)=0 but for the purposes of programming it in an entropy function I only need to define log(0)=0. I apologize for not being more precise. Thanks guys! Maja. Ben Bolker wrote: > > David Winsemius <dwinsemius <at> comcast.net> writes: > >> >> >> On Jan 17, 2010, at 8:17 PM, maiya wrote: >> >> > >> > There must be a very basic thing I am not getting... >> > >> > I'm working with some entropy functions and the convention is to use >> > log(0)=0. >> > >> >> I suppose the outcome of that effort may depend on whether you have >> assumed the needed godlike capacities to change the laws of >> mathematics. But I suppose that as the Earth mother that might occur >> to you. Go ahead, define a new mathematics. > > My guess is that the real intention here is > to define 0*log(0) = 0 rather than log(0) = 0 -- > really the assertion is that lim(x -> 0) x log(x) = 0, > which must be true for some reasonable limiting conditions. > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > > -- View this message in context: http://n4.nabble.com/function-to-set-log-0-0-not-working-on-tables-or-vectors-tp1016278p1016724.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.