[R] Setting log(0) to 0

Terji Petersen Terji78 at yahoo.com
Wed Feb 16 13:08:30 CET 2005


Hi,

I'm trying to do  a regression like this:

wage.r = lm( log(WAGE) ~ log(EXPER)

where EXPER is an integer that goes from 0 to about 50. EXPER contains 
some zeros, so you can't take its log, and the above regression 
therefore fails. I would like to make R accept log(0) as 0, is that 
possible? Or do I have first have to turn the 0's into 1's to be able to 
do the above regression?

Regards

T Petersen




More information about the R-help mailing list