How to treat '-Inf' values in R




While trying to explore and manipulate my dataset from bike sharing dataset on Kaggle, I took log of one variable and stored it in another. I am getting a lot of -Inf values in that column. How to treat them?


Hi Aditya,

U can treat them as:

df[1]<- NA

In place of df it will be your data frame name and for 1 you can give your column position which is giving infinity values.
But more important is what column is it,and finding out if there is any other transformation that you can use because if there are meaningful values in the original data and converting them by log is giving Inf then that might not be a very good transformation.
So if you could please elaborate a little more with a snapshot of the data,it would be helpful!!