R/interpolate_section.R
interpolate_section.Rd
Wrapper function which interpolates 3D data. Designed for oceanographic section plots.
interpolate_section( df = NULL, x, y, z, method = "linear", format = "ggplot", nx = 100, ny = 100, scale_distances = FALSE, log_y = FALSE, extrapolate = FALSE, na.rm = TRUE, return_df_names = FALSE )
df | data frame. Can be |
---|---|
x, y, z | coordinates as numeric vectors, if |
method | Character specifying the interpolation method. Options: "linear", "spline", "mba", and "idw" |
format | Character specifying the output format. Options: "ggplot" (for plotting with ggplot2), "image" (for plotting with the |
nx, ny | Integer giving the dimensions for the output |
scale_distances | Logical indicating whether |
log_y | logical indicating whether y axis should be interpolated using |
extrapolate | logical indicating whether the interpolation function should be allowed to extrapolate beyond initial data. |
na.rm | logical indicating whether rows containing NA values should be omited from |
return_df_names | logical indicating whether the original column names should be returned instead of x, y, and z if |
Returns a data.frame with interpolated x,y,z
coordinates.
This is a wrapper function which uses existing interpolation solutions. Following interpolation method
s have been implemented:
"linear"
for linear interpolation using the interp
function with linear = TRUE
.
"spline"
for spline interpolation using the interp
function with linear = FALSE
.
"mba"
for multilevel B-spline interpolation using the mba.surf
function. Appears to produce the best looking results. Recommended.
"idw"
for inverse distance weighted interpolation using the idw
function. This function was originally developed for spatial data where x- and y axes are given in the same units and have similar effect on the result. While it would, no doubt, be possible to account section design in the model specification, this has not been done in the interpolate_section
function. Therefore, using this option is not recommended.