Setting up a soap film smoother is often a hard and frustrating process. This packages provides functions that checks the boundary, knots, and data that you feed to a soap are “correct”. The functions in the package will also plot the area that will be modeled by the soap film smoother in red, and knots and/or data as circles as viable locations. Any circles that have a X through them are considered inadequate and will need to be removed.
To do the spatial analysis, we require a couple of extra libraries: {sf} and {mgcv}. That will be loaded when installing {soapcheckr}.
{soapcheckr}
can be installed using the following code;
install.packages("devtools")
devtools::install_github("dill/soapcheckr")
Next load {soapcheckr}
and walk through the vignette to see how to use
the functions. We highly encourage walking through both examples in the
vignette.
library(soapcheckr)
vignette("how_to_use_soapcheckr")
- Note that you need to set the
k
andnmax
argument inautocruncher()
to be the same as your planned value ingam()
for your soap film smoother - The functions assumes that your spatial variable names are
x
andy
unless you supply the naming arguments with the column names from your data. - Make sure that your locations are in Northings/Eastings, (e.g., UTMs). Using latitude and longitude (e.g., decimal degree) will give strange results (as the soap film smoother is isotropic so treats 1 unit change in either dimension is equal, this isn’t true for lat/long!).
- Sometimes you need to increase the tolerance (e.g
tol = 1e-6
) argument when usingsoap_check()
- Note that the boundary must be a
list
oflist
s ordata.frame
s. So if you have a polygon boundary with your boundary vertices in it, that must be wrapped in alist
! The vector names of each boundary need to be namesx
andy
for the functions to work.
Written by David L. Miller and Benjamin L. Hlina. Released under the GPL (version 2).