[R] R truncating decimal places

Andrea Goijman andrea.goijman at gmail.com
Mon May 22 21:10:49 CEST 2017


Hello list,

I' trying to estimate a log likelihood function from my data.
I apply the mean to all my simulations, and I get something like this:

apply(likelihood, c(2, 3, 4), mean,na.rm=TRUE)
, , 1

             [,1]       [,2]       [,3]      [,4]      [,5]        [,6]
 [,7]
  [1,] 0.73162327 0.81197093 0.58216435 0.7295733 0.8930731 0.971775402
0.8882391
  [2,] 0.73162327 0.81197093 0.00000000 0.7295733 0.8930731 0.971775402
0.8882391

If you note, there is a 0.00000000 value, and it seems that R is truncating
it as a zero, because when I apply the log

apply(likelihood, c(2, 3, 4), mean,na.rm=TRUE)

I get a "-inf" at that position...


How do I avoid R truncating this value?

Thanks!

Andrea

	[[alternative HTML version deleted]]



More information about the R-help mailing list