Kaja
Kaja

Reputation: 3057

Checking NaN value in r

I have a code which generate NaN values:

j<-c(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)
m=acf(j,lag.max=32,ylim=c(-1,1),plot=FALSE)

I want to check if the values are Nan :

is.nan(m[1])

but I am getting this error:

Error in is.nan(m[1]) : default method not implemented for type 'list'

what shoul I do to solve this problem? (checking Nan valus)

Upvotes: 0

Views: 3063

Answers (1)

MrFlick
MrFlick

Reputation: 206586

acf returns a named list. If you want to find NaN values in the acf estimates, use

is.nan(m$acf)

Upvotes: 1

Related Questions