setmask {adehabitat} | R Documentation

## Applies a Mask on Objects of Class 'asc' or 'kasc'

### Description

Applies a mask on objects of class `asc` or `kasc`. In other words, the function creates an object of class `asc` or `kasc`, with `NA` for all pixels `NA` on the masking map.

### Usage

    setmask(x, mask)

### Arguments

`x` | an object of class `asc` or `kasc`
`mask` | an object of class `asc`

### Value

Returns an object of class `asc` or `kasc`

### Author(s)

Clément Calenge calenge@biomserv.univ-lyon1.fr

### See Also

`import.asc` for additionnal information on objects of class `asc`.

### Examples

    data(puechabon)
    kasc <- puechabon$kasc
    image(kasc)
    elev <- getkasc(kasc, "Elevation")
    slope <- getkasc(kasc, "Slope")

    ## ma is the mask: only areas with elevation > 250 m
    ## are kept
    ma <- elev
    ma[ma < 250] <- NA
    ma <- getascattr(elev, ma)
    image(ma)

    ## The mask is applied on maps of slope
    slp <- setmask(slope, ma)
    image(slp)

    ## The mask is applied on all maps in kasc
    im <- setmask(kasc, ma)
    image(im)

[Package adehabitat version 1.4 Index]