getascattr {adehabitat} | R Documentation

## Copy the Attributes of an Object of Class 'asc' or 'kasc' to another Object

### Description

`getascattr` copies the attributes of an object of class `asc` to another matrix of the same size.
`getkascattr` performs the same operation for objects of class `kasc`.

### Usage

    getascattr(xfrom, xto, type = c("numeric", "factor"), lev = NULL)
    getkascattr(xkfrom, xkto)

### Arguments

`xfrom` | an object of class `asc`
`xto` | a matrix with the same number of rows and columns as `xfrom`
`type` | a character string giving the type of the map (`"factor"` for maps of categorical variables, and `"numeric"` otherwise)
`lev` | if `type = "factor"`, a character vector giving the levels of the mapped variable (see `help(import.asc)`)
`xkfrom` | an object of class `kasc`
`xkto` | a data frame with the same number of rows and columns as `xkfrom`

### Value

`getascattr` returns a raster matrix of class `asc`,
`getkascattr` returns a data frame of class `kasc`

### Author(s)

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

### See Also

`import.asc`, `as.kasc`

### Examples

    data(puechabon)

    ## my.map is a map of elevation
    my.map <- getkasc(puechabon$kasc, "Elevation")
    sl <- getkasc(puechabon$kasc, "Slope")
    attributes(sl) <- NULL
    sl <- matrix(sl, ncol = ncol(my.map))

    ## sl is a matrix with the same size as my.map
    toto <- getascattr(my.map, sl)
    image(toto)

    ## same rationale with aspect
    asp <- getkasc(puechabon$kasc, "Aspect")
    le <- levels(asp)
    attributes(asp) <- NULL
    asp <- matrix(asp, ncol = ncol(my.map))

    ## asp is now a matrix with the same size as my.map
    tutu <- getascattr(my.map, asp, typ = "factor", lev = le)
    cl <- colasc(tutu, NorthEast = "blue", SouthEast = "red",
               SouthWest = "orange", NorthWest = "green")
    image(tutu, clfac = cl)

[Package adehabitat version 1.3 Index]