R: NaNs produced

前端 未结 2 922
后悔当初
后悔当初 2021-01-22 15:08

I have a time series in R Studio. Now I want to calculate the log() of this series. I tried the following:

i <- (x-y) 
ii <- log(i)

But

2条回答
  •  旧巷少年郎
    2021-01-22 15:51

    As I said in my comment, to know which observation generated the NaN, you can use function which:

    i <- c(9,8,4,5,7,1,6,-1,8,4)
    which(is.nan(log(i))) # 8
    

提交回复
热议问题