convnum {adehabitat} | R Documentation

## Conversion from Factor to Numeric for Raster Map

### Description

The objects of class `kasc` may contain maps of type `"numeric"` (e.g. the elevation) or of type `"factor"` (e.g. the type of vegetation). `convnum` centres and scales the maps of type `"numeric"`, and factor maps are transformed into a collection of k maps of type `"numeric"` (where k is the number of levels of the factor), with zero means and unit variance (see `dudi.mix` in the `ade4` package for further details).

### Usage

    convnum(kasc)

### Arguments

`kasc` | an object of class `kasc`

### Value

Returns a list with the following components:

`kasc` | an object of class `kasc`
`weight` | the weights associated with each map of the object kasc, so that the collection of maps defining a categorical variable has the same weight that a numeric variable (see examples).

### Author(s)

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

### See Also

`dudi.mix`, `as.kasc`

### Examples

    ## loads the data
    data(puechabon)
    kasc <- puechabon$kasc
    image(kasc)

    ## scales all the variables
    toto <- convnum(kasc)
    image(toto$kasc)

    ## the Aspect has four levels:
    ## four variables have been defined.
    toto$weight

    ## The sum of the weights given to each
    ## level of aspect is equal to:
    toto$weight[2:5]
    sum(toto$weight[2:5])

    ## The same weight is therefore given to the factor variable Aspect and
    ## to any continuous variable, e.g. the elevation.

[Package adehabitat version 1.4 Index]