get_unique_values: get_unique_values

Description Usage Arguments Details Examples

Description

This function returns the unique values of an object.

Usage

 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
get_unique_values(x, simplify, verbose)

## S3 method for class 'numeric'
get_unique_values(x, simplify = FALSE,
  verbose = TRUE)

## S3 method for class 'matrix'
get_unique_values(x, simplify = FALSE, verbose = TRUE)

## S3 method for class 'RasterLayer'
get_unique_values(x, simplify = FALSE,
  verbose = TRUE)

## S3 method for class 'list'
get_unique_values(x, simplify = FALSE, verbose = TRUE)

## S3 method for class 'RasterStack'
get_unique_values(x, simplify = FALSE,
  verbose = TRUE)

## S3 method for class 'RasterBrick'
get_unique_values(x, simplify = FALSE,
  verbose = TRUE)

## S3 method for class 'stars'
get_unique_values(x, simplify = FALSE, verbose = TRUE)

Arguments

x

vector, matrix or Raster* object

simplify

If true, a vector will be returned instead of a list for 1-dimensional input

verbose

If true, warning messages are printend

Details

Fast and memory friendly Rcpp implementation to find the unique values of an object.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
get_unique_values(landscape)

landscape_stack <- raster::stack(landscape, landscape, landscape)
get_unique_values(landscape_stack)

landscape_matrix <- raster::as.matrix(landscape)
get_unique_values(landscape_matrix)

x_vec <- c(1, 2, 1, 1, 2, 2)
get_unique_values(x_vec)

landscape_list <- list(landscape, landscape_matrix, x_vec)
get_unique_values(landscape_list)

r-spatialecology/landscapemetrics documentation built on May 20, 2019, noon