x3p_extract: Extract values from a surface matrix based on a mask

View source: R/x3p_extract.R

x3p_extractR Documentation

Extract values from a surface matrix based on a mask

Description

If a mask is present, a subset of the surface matrix is extracted based on specified value(s).

Usage

x3p_extract(x3p, mask_vals)

Arguments

x3p

x3p object

mask_vals

vector of mask value(s)

Value

x3p object

Examples

logo <- x3p_read(system.file("csafe-logo.x3p", package="x3ptools"))
# add a mask
logo <- x3p_add_mask(logo)
mask <- t(logo$surface.matrix==median(logo$surface.matrix))
logo <- x3p_add_mask_layer(logo, mask, color = "red", annotation = "median") 
x3p_extract(logo, "#cd7f32") 
# x3p_image(logo, size=c(500,500), zoom = 1)

x3ptools documentation built on May 29, 2024, 10:33 a.m.