Description Usage Arguments Value See Also Examples

approxNA uses the `stats`

function `approx`

to estimate values for cells that are `NA`

by interpolation across layers. Layers are considered equidistant, unless an argument 'z' is used, or `getZ`

returns values, in which case these values are used to determine distance between layers.

For estimation based on neighbouring cells see `focal`

1 2 3 |

`x` |
RasterStack or RasterBrick object |

`filename` |
character. Output filename (optional) |

`method` |
specifies the interpolation method to be used. Choices are "linear" or "constant" (step function; see the example in |

`yleft` |
the value to be returned before a non- |

`yright` |
the value to be returned after the last non- |

`rule` |
an integer (of length 1 or 2) describing how interpolation is to take place at for the first and last cells (before or after any non- |

`f` |
for method = "constant" a number between 0 and 1 inclusive, indicating a compromise between left- and right-continuous step functions. If y0 and y1 are the values to the left and right of the point then the value is |

`ties` |
Handling of tied 'z' values. Either a function with a single vector argument returning a single number result or the string "ordered" |

`z` |
numeric vector to indicate the distance between layers (e.g., time, depth). The default is 1:nlayers(x) |

`NArule` |
single integer used to determine what to do when only a single layer with a non- |

`...` |
additional arguments as for |

RasterBrick

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ```
r <- raster(ncols=5, nrows=5)
r1 <- setValues(r, runif(ncell(r)))
r2 <- setValues(r, runif(ncell(r)))
r3 <- setValues(r, runif(ncell(r)))
r4 <- setValues(r, runif(ncell(r)))
r5 <- setValues(r, NA)
r6 <- setValues(r, runif(ncell(r)))
r1[6:10] <- NA
r2[5:15] <- NA
r3[8:25] <- NA
s <- stack(r1,r2,r3,r4,r5,r6)
s[1:5] <- NA
x1 <- approxNA(s)
x2 <- approxNA(s, rule=2)
x3 <- approxNA(s, rule=2, z=c(1,2,3,5,14,15))
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.