try user-defined function approach


this does not necessary to prepare large amount of RAM.

```{r}
na_func <- function(x){
x[x <= 0.5] <- NA
return(as.vector(x))
}

stk <- stack(r1,r2,r3,r4,r5,r6)
system.time(ans <- calc(stk, na_func))
summary(ans)
```

user system elapsed
10.585 0.254 10.898



#### calculation for temporal interpolating NA values in raster stack.


very nice function by https://stat.ethz.ch/pipermail/r-sig-geo/2010-December/010216.html
It is always a good way to use calc function, especially when using big raster data.
this do not depend on big RAM space.

```{r}
require(zoo)


fill.NA <- function(x,na.rm = F){
#x[x==0] <- NA
if(length(which(is.na(x)==F))>2){
fill <- approxfun(x, y=NULL, method='linear', rule=2)
rec <- which(is.na(x))
x[rec] <- fill(rec)
}

return(x)
}

stk_fillNA <- calc(stk, fun=fill.NA)

summary(stk_fillNA)

```