Learn R Programming

x3ptools (version 0.0.2)

interpolate_x3p: Interpolate from an x3p object

Description

An interpolated scan is created at specified resolutions resx, resy in x and y direction. The interpolation is based on na.approx from the zoo package. It is possible to create interpolations at a higher resolution than the one specified in the data itself, but it is not recommended to do so. interpolate_x3p can also be used as a way to linearly interpolate any missing values in an existing scan without changing the resolution.

Usage

interpolate_x3p(x3p, resx = 1e-06, resy = resx, maxgap = 1)

Arguments

x3p

x3p object

resx

numeric value specifying the new resolution for the x axis.

resy

numeric value specifying the new resolution for the y axis.

maxgap

integer variable used in na.approx to specify the maximum number of NAs to be interpolated, defaults to 1.

Value

interpolated x3p object

Examples

Run this code
# NOT RUN {
logo <- read_x3p(system.file("csafe-logo.x3p", package="x3ptools"))
# resolution:
logo$header.info$incrementX
# change resolution to 1 micron = 1e-6 meters
logo2 <- interpolate_x3p(logo, resx = 1e-6)
logo2$header.info$incrementX
# }

Run the code above in your browser using DataLab