as.kasc: Working with Several Raster Maps

Description Usage Arguments Value Author(s) See Also Examples

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

1
2
3
4
5
6
7
8
9
as.kasc(l)
getkasc(x, var)
## S3 method for class 'kasc'
image(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, ...)
## S3 method for class 'kasc'
print(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 on the studied map

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)

Clement Calenge clement.calenge@oncfs.gouv.fr

See Also

asc for additionnal information on objects of class asc. image.kasc and explore.kasc for graphical displays of objects of class kasc.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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 = "Slope", 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, var = "Slope", main="Slope")
## similar to
image(cuicui, var = 1, main = "Slope")

adehabitat documentation built on Jan. 28, 2018, 5:02 p.m.