Skip to contents

Trims rows and columns from the edges of a surface matrix that contain missing values only.

Usage

x3p_trim_na(x3p, ratio = 1)

Arguments

x3p

x3p object

ratio

ratio between zero and one, indicating the percent of values that need to be missing in each row and column, for the row or column to be removed

Value

x3p object of the same or smaller dimension where missing values are removed from the boundaries

Examples

logo <- x3p_read(system.file("csafe-logo.x3p", package="x3ptools"))
logo$surface.matrix[logo$surface.matrix == median(logo$surface.matrix)] <- NA
x3p_trim_na(logo) # reduced to dimension: 668 by 268
#> x3p object
#> Instrument: N/A 
#> size (width x height): 669 x 269 in pixel 
#> resolution: 6.4500e-07 x 6.4500e-07 
#> Creator: Heike Hofmann, CSAFE 
#> Comment: image rendered from the CSAFE logo ; cropped from location ( 36 , 74 )