Learn R Programming

raster (version 1.9-44)

factors: Factors

Description

Factors are categorical variables. These functions allow for defining a layer as a categorical variable. This feature is under development, and whether a layer is defined as a factor or not is currently ignored by all other functions.

Usage

is.factor(x)
asFactor(x, ...)
labels(object, ...)
labels(object) <- value

Arguments

x
A Raster* object
object
A Raster* object
value
list
...
Additional arguments

Value

  • Raster* object

Examples

Run this code
r <- raster(nrow=10, ncol=10)
r[] <- (runif(ncell(r)) * 10)
is.factor(r)
r <- round(r)
f <- asFactor(r)
is.factor(f)

Run the code above in your browser using DataLab