Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

get_unique_values

get_unique_values


Description

This function returns the unique values of an object.

Usage

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

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)

landscapemetrics

Landscape Metrics for Categorical Map Patterns

v1.5.2
GPL-3
Authors
Maximillian H.K. Hesselbarth [aut, cre] (<https://orcid.org/0000-0003-1125-9918>), Marco Sciaini [aut] (<https://orcid.org/0000-0002-3042-5435>), Jakub Nowosad [aut] (<https://orcid.org/0000-0002-1057-3721>), Sebastian Hanss [aut] (<https://orcid.org/0000-0002-3990-4897>), Laura J. Graham [ctb] (Input on package structure), Jeffrey Hollister [ctb] (Input on package structure), Kimberly A. With [ctb] (Input on package structure), Florian Privé [ctb] (Original author of underlying C++ code for get_nearestneighbour() function), Project Nayuki [ctb] (Original author of underlying C++ code for get_circumscribingcircle and lsm_p_circle), Matt Strimas-Mackey [ctb] (Bugfix in sample_metrics())
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.