Learn R Programming

x3ptools (version 0.0.4)

x3p_extract: 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)

Value

x3p object

Arguments

x3p

x3p object

mask_vals

vector of mask value(s)

Examples

Run this code
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)

Run the code above in your browser using DataLab