How to transform negative values to logarithms? I would like to know how to transform negative values to log(), since I have heteroskedastic data. I've read that log(x+1) solves the problem but this doesn't work with my data and I continue getting NaNs as result.
For e.g. I get this warning message (I didn't put my complete database because I think one of my negative values is enough to show the problem):
> log(-1.27+1)
[1] NaN
Warning message:
In log(-1.27 + 1) : NaNs produced
> 

UPDATE:
Here is an histogram of my data. I'm working with palaeontological time series of chemical measurements. If the difference between (for e.g.) variables like Ca and Zn is too big, I need some type of data standardization, which is why I'm testing the log() function.

This is my raw data
 A: This has been covered in detail in the comments, but there still isn't an answer stating this. So for the benefit of future readers:
Please DON'T fiddle with your negative values (especially differences!) so that you can apply a log transformation. Strategies such as adding constants introduce bias; this can work out alright if done with care but can also lead to completely incorrect and uninterpretable results. See this thread for more detail about this: Interpreting log-log regression with log(1+x) as independent variable.
Instead, use a transformation that handles negative values naturally. The cube root transformation is an obvious candidate here, as it is simple, easier to interpret than complex options such as rescaled inverse hyperbolic tangents, and  has the advantage that the interesting and special case of 0 is preserved.
As Nick Cox mentions, you will need to implement this carefully yourself because just raising your values to the power of 1/3 will not work in R. Instead, you'll need something like sign(x) * (abs(x))^(1/3).
More generally, it's best to think carefully about the nature of the data and the goal of the analysis while deciding on a transformation, and not letting canned procedures guide how you handle the data.
A: Since logarithm is only defined for positive numbers, you can't take the logarithm of negative values. However, if you are aiming at obtaining a better distribution for your data, you can apply the following transformation.
Suppose you have skewed negative data:
x <- rlnorm(n = 1e2, meanlog = 0, sdlog = 1)
x <- x - 5
plot(density(x))


then you can apply a first transformation to make your data lie in $(-1,1)$:
z <- (x - min(x)) / (max(x) - min(x)) * 2 - 1
z <- z[-min(z)]
z <- z[-max(z)]
min(z); max(z)

and finally apply the inverse hyperbolic tangent:
t <- atanh(z)
plot(density(t))

Now, your data look approximately normally distributed. This is also called Fisher transformation.

