harmoniseLevels: Harmonise the levels of several factors, or factor-valued...

View source: R/factors.R

harmoniseLevelsR Documentation

Harmonise the levels of several factors, or factor-valued pixel images.

Description

Given several factors (or factor-valued pixel images) convert them so that they all use the same set of levels.

Usage

harmoniseLevels(...)

Arguments

...

Factors, or factor-valued pixel images.

Details

All of the arguments ... must be factors, or factor-valued pixel images (objects of class "im").

The levels of each factor will be extracted, and combined by taking the union of all the levels. Then each factor will be converted to a new factor so that all of the new factors have exactly the same set of levels.

Value

A list, containing the same number of arguments as the input, consisting of factors or factor-valued pixel images.

Author(s)

\adrian

.

See Also

levels, levels.im, mergeLevels.

Examples

  (a <- factor(sample(letters[1:3], 10, replace=TRUE)))
  (b <- factor(sample(LETTERS[1:4], 7, replace=TRUE)))
  harmoniseLevels(a,b)

  (A <- gorillas.extra$vegetation)
  (B <- gorillas.extra$slopetype)
  harmoniseLevels(A,B)

spatstat.geom documentation built on Sept. 18, 2024, 9:08 a.m.