Skip to contents

Converts various Whitebox objects to vectors:

Usage

# S4 method for class 'WhiteboxRaster'
as_vector(x, raw = FALSE)
# S4 method for class 'WhiteboxExtent'
as_vector(x)

Arguments

x

Object to convert to vector. Can be:

raw

logical. For WhiteboxRaster only: Should the raw data be returned (raw = TRUE) or should NoData values be transformed to NA (raw = FALSE)?

Value

A vector, with type depending on the input:

Examples

f <- system.file("extdata/dem.tif", package = "wbw")
x <- wbw_read_raster(f)

# Return WhiteboxRaster's data:
head(as_vector(x))
#> [1] 115.4213 112.8404 109.7914 106.8473 105.0610 103.1640

# Return WhiteboxExtent's data:
as_vector(wbw_ext(x))
#>    west    east   south   north 
#> 1925449 1929446 5582091 5585717