as.kasc {adehabitat} | R Documentation

## Working with Several Raster Maps

### Description

`as.kasc` converts a list of matrices of class `asc` into a data frame of class `kasc`.
`getkasc` converts one of the components of a data frame of class `kasc` into a matrix of class `asc`.
`image.kasc` displays a image of maps of class `kasc`.

### Usage

    as.kasc(l)
    getkasc(x, var)
    image.kasc(x,  var=names(x),
               mar=if (length(var)>1) c(0,0,2,0) else c(5.1,4.1,4.1,2.1),
               axes=(length(var) == 1),
               clfac=NULL, col=gray((240:1)/256), mfrow=NULL, ...)
    print.kasc(x, ...)

### Arguments

`l` | a list of objects of class `asc`
`x` | an object of class `kasc`
`var` | for `getkasc`, a character string or a column number. For `image.kasc`, either a vector of character strings, giving the name of one (or several) variable(s) in x, or a vector of integers, giving the number of the columns to be displayed.
`mar` | this parameter is passed as the parameter `mar` of the function `par` (see `help(par)`). By default, this parameter depends of the number of variables in `x`
`axes` | logical. If `TRUE`, axes are drawn on the maps.
`clfac` | an optional list of vectors of character strings. Each element of the list is a vector corresponding to one factor in `x`. Each element of the vector gives the color name associated with each level of the corresponding factor (see Examples).
`col` | a character vector. For numeric maps, the colors to be used
`mfrow` | A vector of the form `c(nr, nc)`. Subsequent figures will be drawn in an `nr`-by-`nc` array on the device by rows
`...` | additional parameters to be passed to the generic functions `image` and `print`

### Value

`as.kasc` returns an object of class `kasc`. The matrices of class `asc` are converted into vectors and coerced into a data frame of class `kasc`. This data frame has the following attributes:

`xll` | the X-coordinate of the center of the lower left pixel of the map
`yll` | the Y-coordinate of the center of the lower left pixel of the map
`cellsize` | the size of a pixel
`nrow` | the number of rows of the map. Caution ! the number of rows of the raster map is the number of columns of the matrix of class `asc`
`ncol` | the number of columns of the map. Caution ! the number of columns of the raster map is the number of rows of the matrix of class `asc`

The different maps in the input list of objects of class `asc` should describe the same area (same attributes: same `cellsize`, same `xll`, same `yll`, and same dimensions).

### 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 is a list of class kasc
    (kasc <- puechabon$kasc)

    ## Stores two elements of the kasc in objects
    ## of class asc
    (asp <- getkasc(kasc, "Aspect"))
    (sl <- getkasc(kasc, "Slope"))

    ## Displays the slopes on the area (numeric)
    image(sl, main = "Aspect", xlab = "Lambert X", ylab = "Lambert Y")

    ## Aspect is a factor:
    ## cl is the list of color associated with the levels
    ## of asp
    cl <- colasc(asp, NorthEast = "blue", SouthEast = "red",
                 SouthWest = "orange", NorthWest = "green")
    image(asp, clfac = cl, main = "Aspect", xlab = "Lambert X",
          ylab = "Lambert Y")
    legend(706500, 3162000, legend=levels(asp), fill=cl, cex=0.7)

    ## Creation of a new kasc with elevation
    ## and slopes
    cuicui <- as.kasc(list(Slope = sl, Aspect = asp))

    ## Displays the kasc object
    ## with random colors for aspect and grey levels for slopes
    image(cuicui)

    ## with cm.colors for slopes (numeric)
    ## and cl for aspect (factor)
    image(cuicui, col = cm.colors(256), clfac = list(Aspect = cl))

    ## plots only slope
    image(cuicui, "Slope", main="Slope")
    ## similar to
    image(cuicui, 1, main = "Slope")

[Package adehabitat version 1.3 Index]