Skip to main content
1 of 6
Darwin PC
  • 551
  • 2
  • 5
  • 10

How to transform negative values to Logarithms in R?

I would like to know how to transform negative values to Log(), since I have heteroskedastic data. I read that it works with the formula Log(x+1) but this doesn't work with my database and I continue getting NaNs as result. E.g. I get this Warning message (I didn't put my complete database because I think with one of my negative values is enough to show an example):

> log(-1.27+1)
[1] NaN
Warning message:
In log(-1.27 + 1) : NaNs produced
> 

Thanks in advance

Darwin PC
  • 551
  • 2
  • 5
  • 10