I am looking for a pattern to detect values that are surrounded by NAs or NaNs.
My data looks like this:
c(1,2,3,NA,NaN,NA,6,9,10,NaN,NA,12,20,NA,NaN,12,NA,45,100,NA,200,NA,NaN,300)
I need to know all single trapped values that are either between NA or NaN.
The result from the above example would be: c(12, 200)
Any elegant ideas?